I have a List from HashMap , so I use List.contains to find out if the list contains the specified HashMap . In case this is the case, I want to extract this element from the list, so How do I know the position of the index, where is the element?
List benefit = new ArrayList(); HashMap map = new HashMap(); map.put("one", "1"); benefit.add(map); HashMap map4 = new HashMap(); map4.put("one", "1"); System.out.println("size: " + benefit.size()); System.out.println("does it contain orig: " + benefit.contains(map)); System.out.println("does it contain new: " + benefit.contains(map4)); if (benefit.contains(map4))
java
Anthony Jan 25 '12 at 18:57 2012-01-25 18:57
source share