Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.awt.image.BufferedImage;
- import java.util.HashMap;
- public class Test {
- public static void main( String[] args ) {
- HashMap<Boolean,BufferedImage> one;// = new HashMap<Integer,BufferedImage>();
- HashMap<Boolean,BufferedImage> two;// = new HashMap<Integer,BufferedImage>();
- HashMap<Integer, HashMap<Boolean,BufferedImage>> hand; // = new HashMap<Integer, HashMap<Boolean,BufferedImage>>();
- one = new HashMap<Boolean, BufferedImage>();
- two = new HashMap<Boolean, BufferedImage>();
- one.put( true, new BufferedImage(0, 0, 0) );
- one.put( false, new BufferedImage(255, 0, 0) );
- two.put( true, new BufferedImage(0, 255, 0) );
- hand = new HashMap<Integer, HashMap<Boolean,BufferedImage>>();
- hand.put( 1, one );
- hand.put( 2, two );
- System.out.println( hand.get( 1 ) ); //should basically be "one"
- System.out.println( ((HashMap<Boolean,BufferedImage>) hand.get( 1 ) ).get(true) ); //should be two's buffImg
- System.out.println( ((HashMap<Boolean,BufferedImage>) hand.get( 1 ) ).get(false) ); //should error
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement