예제 #1
0
  /**
   * Creates a new <code>TIntIntHashMap</code> instance containing all of the entries in the map
   * passed in.
   *
   * @param keys a <tt>int</tt> array containing the keys for the matching values.
   * @param values a <tt>int</tt> array containing the values.
   */
  public TIntIntHashMap(int[] keys, int[] values) {
    super(Math.max(keys.length, values.length));

    int size = Math.min(keys.length, values.length);
    for (int i = 0; i < size; i++) {
      this.put(keys[i], values[i]);
    }
  }
  /**
   * Creates a new <code>TLongFloatHashMap</code> instance containing all of the entries in the map
   * passed in.
   *
   * @param keys a <tt>long</tt> array containing the keys for the matching values.
   * @param values a <tt>float</tt> array containing the values.
   */
  public TLongFloatHashMap(long[] keys, float[] values) {
    super(Math.max(keys.length, values.length));

    int size = Math.min(keys.length, values.length);
    for (int i = 0; i < size; i++) {
      this.put(keys[i], values[i]);
    }
  }
  /**
   * Creates a new <code>TByteShortHashMap</code> instance containing all of the entries in the map
   * passed in.
   *
   * @param keys a <tt>byte</tt> array containing the keys for the matching values.
   * @param values a <tt>short</tt> array containing the values.
   */
  public TByteShortHashMap(byte[] keys, short[] values) {
    super(Math.max(keys.length, values.length));

    int size = Math.min(keys.length, values.length);
    for (int i = 0; i < size; i++) {
      this.put(keys[i], values[i]);
    }
  }
예제 #4
0
  /**
   * Creates a new <code>TFloatByteHashMap</code> instance containing all of the entries in the map
   * passed in.
   *
   * @param keys a <tt>float</tt> array containing the keys for the matching values.
   * @param values a <tt>byte</tt> array containing the values.
   */
  public TFloatByteHashMap(float[] keys, byte[] values) {
    super(Math.max(keys.length, values.length));

    int size = Math.min(keys.length, values.length);
    for (int i = 0; i < size; i++) {
      this.put(keys[i], values[i]);
    }
  }
예제 #5
0
  /**
   * Creates a new <code>TDoubleCharHashMap</code> instance containing all of the entries in the map
   * passed in.
   *
   * @param keys a <tt>double</tt> array containing the keys for the matching values.
   * @param values a <tt>char</tt> array containing the values.
   */
  public TDoubleCharHashMap(double[] keys, char[] values) {
    super(Math.max(keys.length, values.length));

    int size = Math.min(keys.length, values.length);
    for (int i = 0; i < size; i++) {
      this.put(keys[i], values[i]);
    }
  }
예제 #6
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);
 }
예제 #7
0
 /**
  * Creates a new <code>TIntIntHashMap</code> instance containing all of the entries in the map
  * passed in.
  *
  * @param map a <tt>TIntIntMap</tt> that will be duplicated.
  */
 public TIntIntHashMap(TIntIntMap map) {
   super(map.size());
   if (map instanceof TIntIntHashMap) {
     TIntIntHashMap hashmap = (TIntIntHashMap) map;
     this._loadFactor = hashmap._loadFactor;
     this.no_entry_key = hashmap.no_entry_key;
     this.no_entry_value = hashmap.no_entry_value;
     //noinspection RedundantCast
     if (this.no_entry_key != (int) 0) {
       Arrays.fill(_set, this.no_entry_key);
     }
     //noinspection RedundantCast
     if (this.no_entry_value != (int) 0) {
       Arrays.fill(_values, this.no_entry_value);
     }
     setUp((int) Math.ceil(DEFAULT_CAPACITY / _loadFactor));
   }
   putAll(map);
 }
예제 #8
0
 /**
  * Creates a new <code>TShortHashSet</code> instance that is a copy of the existing Collection.
  *
  * @param collection a <tt>Collection</tt> that will be duplicated.
  */
 public TShortHashSet(Collection<? extends Short> collection) {
   this(Math.max(collection.size(), DEFAULT_CAPACITY));
   addAll(collection);
 }
예제 #9
0
 /**
  * Creates a new <code>TShortHashSet</code> instance containing the elements of <tt>array</tt>.
  *
  * @param array an array of <code>short</code> primitives
  */
 public TShortHashSet(short[] array) {
   this(Math.max(array.length, DEFAULT_CAPACITY));
   addAll(array);
 }