org.apache.commons.collections.keyvalue.AbstractMapEntry Java Examples
The following examples show how to use
org.apache.commons.collections.keyvalue.AbstractMapEntry.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: Util.java From youkefu with Apache License 2.0 | 5 votes |
public Set<Entry<K, V>> entrySet() { return new AbstractSet<Entry<K, V>>() { public Iterator<Entry<K, V>> iterator() { return new Iterator<Entry<K, V>>() { private int pt = -1; public void remove() { throw new UnsupportedOperationException(); } @SuppressWarnings("unchecked") public Entry<K, V> next() { return new AbstractMapEntry( list.get(++pt), null) {}; } public boolean hasNext() { return pt < list.size(); } }; } public int size() { return list.size(); } public boolean contains(Object o) { if (o instanceof Entry) { if (list.contains(((Entry) o).getKey())) { return true; } } return false; } }; }