コード例 #1
0
 /** {@inheritDoc} */
 public boolean containsAll(TShortCollection collection) {
   TShortIterator iter = collection.iterator();
   while (iter.hasNext()) {
     if (!TByteShortHashMap.this.containsValue(iter.next())) {
       return false;
     }
   }
   return true;
 }
コード例 #2
0
 /** {@inheritDoc} */
 public boolean containsAll(TShortCollection collection) {
   TShortIterator iter = collection.iterator();
   while (iter.hasNext()) {
     short element = iter.next();
     if (!contains(element)) {
       return false;
     }
   }
   return true;
 }
コード例 #3
0
 /** {@inheritDoc} */
 public boolean removeAll(TShortCollection collection) {
   boolean changed = false;
   TShortIterator iter = collection.iterator();
   while (iter.hasNext()) {
     short element = iter.next();
     if (remove(element)) {
       changed = true;
     }
   }
   return changed;
 }
コード例 #4
0
 /** {@inheritDoc} */
 public boolean retainAll(TShortCollection collection) {
   if (this == collection) {
     return false;
   }
   boolean modified = false;
   TShortIterator iter = iterator();
   while (iter.hasNext()) {
     if (!collection.contains(iter.next())) {
       iter.remove();
       modified = true;
     }
   }
   return modified;
 }
コード例 #5
0
 /**
  * Creates a new <code>TShortHashSet</code> instance that is a copy of the existing set.
  *
  * @param collection a <tt>TShortSet</tt> that will be duplicated.
  */
 public TShortHashSet(TShortCollection collection) {
   this(Math.max(collection.size(), DEFAULT_CAPACITY));
   if (collection instanceof TShortHashSet) {
     TShortHashSet hashset = (TShortHashSet) collection;
     this._loadFactor = hashset._loadFactor;
     this.no_entry_value = hashset.no_entry_value;
     //noinspection RedundantCast
     if (this.no_entry_value != (short) 0) {
       Arrays.fill(_set, this.no_entry_value);
     }
     setUp((int) Math.ceil(DEFAULT_CAPACITY / _loadFactor));
   }
   addAll(collection);
 }