@Override public synchronized boolean add(Long aLong) { version++; return map.put(aLong, TRUE); }
public ColtHashSet( int initialCapacity, double minLoadFactor, double maxLoadFactor ) { map = new OpenLongObjectHashMap( initialCapacity, minLoadFactor, maxLoadFactor ); }
@Override public SnapshotableSet<Long> makeSnapshot() { // map.clone() makes a proper deep copy return (SnapshotableSet<Long>) map.clone(); }
@Override public SnapshotableSet<Long> create() { if (numberType == NumberType.INTEGER) { return new ColtIntegerHashSet( new OpenIntObjectHashMap(initialValue, minLoadFactor, maxLoadFactor) ); } else if (numberType == NumberType.LONG) { return new ColtLongHashSet( new OpenLongObjectHashMap(initialValue, minLoadFactor, maxLoadFactor) ); } else { throw new IllegalStateException(String.format("unknown type %s", numberType)); } } }
@Override public synchronized boolean add(Long aLong) { version++; return map.put(aLong.intValue(), TRUE); }
public ColtIntegerHashSet(int initialCapacity) { this.map = new OpenIntObjectHashMap(initialCapacity); }
@Override public synchronized int size() { return map.size(); }
@Override public synchronized int size() { return map.size(); }
@Override public void remove() { synchronized (ColtIntegerHashSet.this) { if (!canRemove) { throw new IllegalStateException( "repeated remove() calls or next() not called" ); } map.removeKey(mapKeyList.get(index - 1)); canRemove = false; version++; versionSnapshot = version; } } }
@Override public void remove() { synchronized (ColtLongHashSet.this) { if (!canRemove) { throw new IllegalStateException( "repeated remove() calls or next() not called" ); } map.removeKey(mapKeyList.get(index - 1)); canRemove = false; version++; versionSnapshot = version; } } }
/** * Returns a deep copy of the receiver; uses <code>clone()</code> and casts the result. * * @return a deep copy of the receiver. */ public AbstractLongObjectMap copy() { return (AbstractLongObjectMap) clone(); } /**
/** * Returns <tt>true</tt> if the receiver contains the specified key. * * @return <tt>true</tt> if the receiver contains the specified key. */ public boolean containsKey(double key) { return indexOfKey(key) >= 0; } /**
/** * Returns <tt>true</tt> if the receiver contains the specified value. * * @return <tt>true</tt> if the receiver contains the specified value. */ public boolean containsValue(int value) { return indexOfValue(value) >= 0; } /**
@Override public SnapshotableSet<Long> makeSnapshot() { OpenIntObjectHashMap mapCopy = (OpenIntObjectHashMap) map.clone(); ColtIntegerHashSet thisCopy = new ColtIntegerHashSet(mapCopy); return thisCopy; }
@Override public synchronized boolean add(Long aLong) { version++; return map.put(aLong.longValue(), TRUE); }
public ColtHashSet(int initialCapacity) { map = new OpenLongObjectHashMap(initialCapacity); }
@Override public synchronized int size() { return map.size(); }
@Override public void remove() { synchronized (ColtHashSet.this) { if (!canRemove) { throw new IllegalStateException( "repeated remove() calls or next() not called" ); } map.removeKey(mapKeyList.get(index-1)); canRemove = false; version++; versionSnapshot = version; } } }
@Override public SnapshotableSet<Long> makeSnapshot() { OpenLongObjectHashMap mapCopy = (OpenLongObjectHashMap) map.clone(); ColtLongHashSet thisCopy = new ColtLongHashSet(mapCopy); return thisCopy; }
public ColtLongHashSet(int initialCapacity) { this.map = new OpenLongObjectHashMap(initialCapacity); }