Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /**
- * Created by pakkio on 01/02/2016.
- */
- public class Main {
- static HashMap<Object,Object>map=new HashMap<Object, Object>();
- public static void main(String[] args) {
- byte[] b1=new byte[]{ 1,2,3};
- byte[] b2=new byte[]{ 1,2,3};
- insert(b1,"value1");
- remove(b1);
- insert(b1,"value2");
- remove(b2);
- System.out.println(map.size()+ " should be 0");
- }
- private static void remove(Object input) {
- map.remove(convert(input));
- }
- private static void insert(Object input, Object value) {
- map.put(convert(input),value);
- }
- private static Object convert(Object input){
- //if(true) return input;
- if(input instanceof byte[]){
- return new String((byte[])input);
- }
- return input;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement