Guava EnumHashBiMap - top ranked examples from Open Source projects

These code examples were ranked by Codota’s semantic indexing as the best open source examples for Guava EnumHashBiMap class.

This code example shows how to use the following methods:put
        bean.hashBiMap.put( "one", 1 );
 
        bean.biMap = bean.hashBiMap;
 
        bean.enumHashBiMap = EnumHashBiMap.create( AlphaEnum.class );
        bean.enumHashBiMap.put( AlphaEnum.A, 1 );
        bean.enumHashBiMap.put( AlphaEnum.D, 4 );
        bean.enumHashBiMap.put( AlphaEnum.C, 3 );
        bean.enumHashBiMap.put( AlphaEnum.B, 2 );
 
        bean.enumBiMap = EnumBiMap.create( AlphaEnum.class, NumericEnum.class );
        bean.enumBiMap.put( AlphaEnum.A, NumericEnum.ONE );
        bean.enumBiMap.put( AlphaEnum.D, NumericEnum.FOUR );
        bean.enumBiMap.put( AlphaEnum.C, NumericEnum.THREE );
        bean.enumBiMap.put( AlphaEnum.B, NumericEnum.TWO );
 
        String expected = "{" +
                "\"biMap\":{\"one\":1}," + 
                "\"hashBiMap\":{\"one\":1}," + 
                "\"enumHashBiMap\":{\"A\":1,\"B\":2,\"C\":3,\"D\":4}," + 
4
CodeRank
Experience pair programming with AI  Get Codota for Java