Advertisement
apl-mhd

Custom generic type Map

Feb 23rd, 2018
160
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.35 KB | None | 0 0
  1. package com.company;
  2.  
  3. import java.util.HashMap;
  4. import java.util.Map;
  5.  
  6. public class MyMap<T,V> {
  7.  
  8.  
  9.     T key;
  10.     V value;
  11.  
  12.  
  13.  static    HashMap a = new HashMap();
  14.  
  15.  
  16.     void put(T key,V value){
  17.  
  18.         a.put(this.key = key,this.value = value);
  19.  
  20.  
  21.  
  22.     }
  23.  
  24.  
  25.     public T get(T key){
  26.  
  27.  
  28.         return (T) a.get(this.key);
  29.     }
  30.  
  31.  
  32. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement