1 package jfun.yan.element; 2 3 import java.util.List ; 4 5 import jfun.util.Misc; 6 7 13 public class ListStore<T> implements ElementStore<T> { 14 private final List <T> list; 15 16 19 public List <T> getList() { 20 return list; 21 } 22 23 27 public ListStore(List <T> list) { 28 this.list = list; 29 } 30 31 public void storeElement(int ind, T obj) { 32 list.add(obj); 33 } 34 35 public boolean equals(Object obj) { 36 if(obj instanceof ListStore){ 37 final ListStore other = (ListStore)obj; 38 return list==other.list; 39 } 40 else return false; 41 } 42 43 public int hashCode() { 44 return System.identityHashCode(list); 45 } 46 47 public String toString() { 48 return Misc.getTypeName(list.getClass()); 49 } 50 51 } 52 | Popular Tags |