Package com.google.common.collect

Examples of com.google.common.collect.MapMaker


     */

    private void pumpOffHeap( int ops, byte[] payload )
    {

        ConcurrentMap<String, ByteBuffer> test = new MapMaker().concurrencyLevel( 4 ).makeMap();

        logger.info( Ram.inMb( ops * payload.length ) + " in " + ops + " slices to store" );

        ByteBuffer bulk = ByteBuffer.allocateDirect( ops * payload.length );

View Full Code Here


    }

    private void pumpTheHeap( int ops, byte[] payload )
    {

        ConcurrentMap<String, byte[]> test = new MapMaker().concurrencyLevel( 4 ).makeMap();

        logger.info( Ram.inMb( ops * payload.length ) + " in " + ops + " slices to store" );

        double started = System.currentTimeMillis();

View Full Code Here

    @Test
    public void withMap()
    {

        ConcurrentMap<Long, Pointer<Object>> map =
            new MapMaker().concurrencyLevel( 4 ).initialCapacity( 500000 ).makeMap();

        String str = "This is the string to store into the off-heap memory";

        int size = str.length();
        int howMany = 1000000;
View Full Code Here

    @Test
    public void withMap()
    {

        ConcurrentMap<Long, Pointer<Object>> map =
            new MapMaker().concurrencyLevel( 4 ).initialCapacity( 500000 ).makeMap();

        String str = "This is the string to store into the off-heap memory";

        int size = str.length();
        int howMany = 1000000;
View Full Code Here

      };

  /** Returns a map that uses an {@code ArrayList} as a default value. */
  @SuppressWarnings({ "unchecked" })
  public static <K, V> Map<K, List<V>> newListValuedMap() {
    return new MapMaker().makeComputingMap(
        (Function<K, List<V>>) CREATE_ARRAY_LIST);
  }
View Full Code Here

   * default value for the outer map.
   */
  @SuppressWarnings({"unchecked"})
  public static <K1, K2, V> Map<K1, Map<K2, V>>
  newDoubleKeyedValueMap() {
    return new MapMaker().makeComputingMap(
        (Function<K1, Map<K2, V>>) CREATE_MAP);
  }
View Full Code Here

   * values.
   */
  @SuppressWarnings({"unchecked"})
  public static <K1, K2, V> Map<K1, Map<K2, V>>
  newDoubleKeyedDefaultingValueMap(final Function<K2, V> defaultingFunction) {
    return new MapMaker().makeComputingMap(
        new Function<K1, Map<K2, V>>() {
          @Override
          public Map<K2, V> apply(K1 obj) {
            return new MapMaker().makeComputingMap(defaultingFunction);
          }
        });
  }
View Full Code Here

   * value.
   */
  @SuppressWarnings({ "unchecked" })
  public static <K1, K2, V> Map<K1, Map<K2, List<V>>>
  newDoubleKeyedListValuedMap() {
    return new MapMaker().makeComputingMap(
        (Function<K1, Map<K2, List<V>>>) CREATE_LIST_VALUED_MAP);
  }
View Full Code Here

   * value.
   */
  @SuppressWarnings({ "unchecked" })
  public static <K1, K2, K3, V> Map<K1, Map<K2, Map<K3, List<V>>>>
  newTripleKeyedListValuedMap() {
    return new MapMaker().makeComputingMap(
        (Function<K1, Map<K2, Map<K3, List<V>>>>)
            CREATE_DOUBLE_LIST_VALUED_MAP);
  }
View Full Code Here

      };

  /** Returns a map that uses a {@code HashSet} as a default value. */
  @SuppressWarnings({ "unchecked" })
  public static <K, V> Map<K, Set<V>> newSetValuedMap() {
    return new MapMaker().makeComputingMap(
        (Function<K, Set<V>>) CREATE_HASH_SET);
  }
View Full Code Here

TOP

Related Classes of com.google.common.collect.MapMaker

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.