Package java.util

Examples of java.util.EnumMap


    @SuppressWarnings( "unchecked" )
    @Override
    public EnumMap<?, ?> read( final ByteBuffer buffer ) {
        final Class<?> keyType = _kryo.readClass( buffer ).getType();
        final EnumMap result = new EnumMap( keyType );
        final int size = IntSerializer.get( buffer, true );
        for ( int i = 0; i < size; i++ ) {
            final Object key = EnumSerializer.get( buffer, keyType );
            final Object value = _kryo.readClassAndObject( buffer );
            result.put( key, value );
        }
        return result;
    }
View Full Code Here


        Suit.CLUBS, "value1",
        Suit.DIAMONDS, "value2"
    };

    static void test() {
        EnumMap map = new EnumMap(Suit.class);
        map.put(array[0], array[1]);
    }
View Full Code Here

    private static final Object FAKE_REFERENCE = new Object();

    @Override
    @SuppressWarnings({ "unchecked", "rawtypes" })
    public EnumMap<? extends Enum<?>, ?> copy (final Kryo kryo, final EnumMap<? extends Enum<?>, ?> original) {
        return new EnumMap(original);
    }
View Full Code Here

    @SuppressWarnings( { "unchecked", "rawtypes" } )
    private EnumMap<? extends Enum<?>, ?> create(final Kryo kryo, final Input input,
        final Class<EnumMap<? extends Enum<?>, ?>> type) {
        final Class<? extends Enum<?>> keyType = kryo.readClass( input ).getType();
        return new EnumMap( keyType );
    }
View Full Code Here

            final Class<EnumMap<? extends Enum<?>, ?>> type) {
        kryo.reference(FAKE_REFERENCE);
        final EnumMap<? extends Enum<?>, ?> result = create(kryo, input, type);
        final Class<Enum<?>> keyType = getKeyType( result );
        final Enum<?>[] enumConstants = keyType.getEnumConstants();
        final EnumMap rawResult = result;
        final int size = input.readInt(true);
        for ( int i = 0; i < size; i++ ) {
            final int ordinal = input.readInt(true);
            final Enum<?> key = enumConstants[ordinal];
            final Object value = kryo.readClassAndObject( input );
            rawResult.put( key, value );
        }
        return result;
    }
View Full Code Here

/*     */   }
/*     */
/*     */   RuntimeEnumLeafInfoImpl(RuntimeModelBuilder builder, Locatable upstream, Class<T> enumType)
/*     */   {
/*  82 */     super(builder, upstream, enumType, enumType);
/*  83 */     this.printMap = new EnumMap(enumType);
/*     */
/*  85 */     this.baseXducer = ((RuntimeNonElement)this.baseType).getTransducer();
/*     */   }
View Full Code Here

    return localEnumHashBiMap;
  }

  private EnumHashBiMap(Class paramClass)
  {
    super(WellBehavedMap.wrap(new EnumMap(paramClass)), Maps.newHashMapWithExpectedSize(((Enum[])paramClass.getEnumConstants()).length));
    this.keyType = paramClass;
  }
View Full Code Here

  private void readObject(ObjectInputStream paramObjectInputStream)
    throws IOException, ClassNotFoundException
  {
    paramObjectInputStream.defaultReadObject();
    this.keyType = ((Class)paramObjectInputStream.readObject());
    setDelegates(WellBehavedMap.wrap(new EnumMap(this.keyType)), new HashMap(((Enum[])this.keyType.getEnumConstants()).length * 3 / 2));
    Serialization.populateMap(this, paramObjectInputStream);
  }
View Full Code Here

    return localEnumBiMap;
  }

  private EnumBiMap(Class paramClass1, Class paramClass2)
  {
    super(WellBehavedMap.wrap(new EnumMap(paramClass1)), WellBehavedMap.wrap(new EnumMap(paramClass2)));
    this.keyType = paramClass1;
    this.valueType = paramClass2;
  }
View Full Code Here

    throws IOException, ClassNotFoundException
  {
    paramObjectInputStream.defaultReadObject();
    this.keyType = ((Class)paramObjectInputStream.readObject());
    this.valueType = ((Class)paramObjectInputStream.readObject());
    setDelegates(WellBehavedMap.wrap(new EnumMap(this.keyType)), WellBehavedMap.wrap(new EnumMap(this.valueType)));
    Serialization.populateMap(this, paramObjectInputStream);
  }
View Full Code Here

TOP

Related Classes of java.util.EnumMap

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.