Package gnu.trove

Examples of gnu.trove.TIntObjectHashMap


  private TIntObjectHashMap backing = new TIntObjectHashMap ();

  public MIntInt2ObjectMap () { }
  public MIntInt2ObjectMap (int initialCapacity) {
    backing = new TIntObjectHashMap (initialCapacity);
  }
View Full Code Here


    backing = new TIntObjectHashMap (initialCapacity);
  }

  public Object put (int key1, int key2, Object value)
  {
    TIntObjectHashMap inner;
    if (backing.containsKey (key1)) {
      inner = (TIntObjectHashMap) backing.get (key1);
    } else {
      inner = new TIntObjectHashMap ();
      backing.put (key1, inner);
    }

    return inner.put (key2, value);
  }
View Full Code Here

    return inner.put (key2, value);
  }

  public Object get (int key1, int key2)
  {
    TIntObjectHashMap inner = (TIntObjectHashMap) backing.get (key1);
    if (inner == null) {
      return null;
    } else {
      return inner.get (key2);
    }
  }
View Full Code Here

  }

  /** Returns an iterator over the set of (key2, value) pairs that match (key1). */
  public TIntObjectIterator curry (int key1)
  {
    final TIntObjectHashMap inner = (TIntObjectHashMap) backing.get (key1);
    if (inner == null) {
      return new TIntObjectIterator (new TIntObjectHashMap ());
    } else {
      return new TIntObjectIterator (inner);
    }
  }
View Full Code Here

  {
    final int[] N = new int[]{0};
    backing.forEachValue (new TObjectProcedure() {
      public boolean execute (Object object)
      {
        TIntObjectHashMap inner = (TIntObjectHashMap) object;
        N[0] += inner.size ();
        return true;
      }
    });
    return N[0];
  }
View Full Code Here

    return N[0];
  }

  public int[] keys2 (int key1)
  {
    TIntObjectHashMap inner = (TIntObjectHashMap) backing.get (key1);
    return inner.keys ();
  }
View Full Code Here

  private void readObject (ObjectInputStream in) throws IOException, ClassNotFoundException
  {
    in.readInt (); // version =

    int N1 = in.readInt ();
    backing = new TIntObjectHashMap (N1);

    for (int i = 0; i < N1; i++) {
      int k1 = in.readInt ();
      int N2 = in.readInt ();
      for (int j = 0; j < N2; j++) {
View Full Code Here

  private TIntObjectHashMap backing = new TIntObjectHashMap ();

  public void add (int key1, int key2, Object value)
  {
    TIntObjectHashMap inner = (TIntObjectHashMap) backing.get (key1);
    if (inner == null) {
      inner = new TIntObjectHashMap ();
      backing.put (key1, inner);
    }

    List lst = (List) inner.get (key2);
    if (lst == null) {
      lst = new ArrayList ();
      inner. put (key2, lst);
    }

    lst.add (value);
  }
View Full Code Here

    lst.add (value);
  }

  public List get (int key1, int key2)
  {
    TIntObjectHashMap inner = (TIntObjectHashMap) backing.get (key1);
    if (inner == null) {
      return null;
    } else {
      return (List) inner.get (key2);
    }
  }
View Full Code Here

  {
    final int[] N = new int[]{0};
    backing.forEachValue (new TObjectProcedure() {
      public boolean execute (Object object)
      {
        TIntObjectHashMap inner = (TIntObjectHashMap) object;
        N[0] += inner.size ();
        return true;
      }
    });
    return N[0];
  }
View Full Code Here

TOP

Related Classes of gnu.trove.TIntObjectHashMap

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.