public static void registerSerializers(final Kryo kryo) {

        // ImmutableList (abstract class)
        //  +- RegularImmutableList
        //  |   RegularImmutableList
        //  +- SingletonImmutableList
        //  |   Optimized for List with only 1 element.
        //  +- SubList
        //  |   Representation for part of ImmutableList
        //  +- ReverseImmutableList
        //  |   For iterating in reverse order
        //  +- StringAsImmutableList
        //  |   Used by Lists#charactersOf
        //  +- Values (ImmutableTable values)
        //      Used by return value of #values() when there are multiple cells

        final ImmutableListSerializer serializer = new ImmutableListSerializer();

        kryo.register(ImmutableList.class, serializer);

        // Note:
        //  Only registering above is good enough for serializing/deserializing.
        //  but if using Kryo#copy, following is required.

        kryo.register(ImmutableList.of().getClass(), serializer);
        kryo.register(ImmutableList.of(1).getClass(), serializer);
        kryo.register(ImmutableList.of(1, 2, 3, 4).subList(1, 3).getClass(), serializer);
        kryo.register(ImmutableList.of(1, 2).reverse().getClass(), serializer);

        kryo.register(Lists.charactersOf("KryoRocks").getClass(), serializer);

        Table<Integer,Integer,Integer> baseTable = HashBasedTable.create();
        baseTable.put(1, 2, 3);
        baseTable.put(4, 5, 6);
        Table<Integer, Integer, Integer> table = ImmutableTable.copyOf(baseTable);
        kryo.register(table.values().getClass(), serializer);

    }
public static void registerSerializers(final Kryo kryo) {

        
        
        
        
        
        
        
        
        
        
        
        
        

        final ImmutableListSerializer serializer = new ImmutableListSerializer();

        kryo.register(ImmutableList.class, serializer);

        
        
        

        kryo.register(ImmutableList.of().getClass(), serializer);
        kryo.register(ImmutableList.of(1).getClass(), serializer);
        kryo.register(ImmutableList.of(1, 2, 3, 4).subList(1, 3).getClass(), serializer);
        kryo.register(ImmutableList.of(1, 2).reverse().getClass(), serializer);

        kryo.register(Lists.charactersOf("KryoRocks").getClass(), serializer);

        Table<Integer,Integer,Integer> baseTable = HashBasedTable.create();
        baseTable.put(1, 2, 3);
        baseTable.put(4, 5, 6);
        Table<Integer, Integer, Integer> table = ImmutableTable.copyOf(baseTable);
        kryo.register(table.values().getClass(), serializer);

    }
public static void registerSerializers ( final Kryo kryo ) { // ImmutableList (abstract class) //  +- RegularImmutableList //  |   RegularImmutableList //  +- SingletonImmutableList //  |   Optimized for List with only 1 element. //  +- SubList //  |   Representation for part of ImmutableList //  +- ReverseImmutableList //  |   For iterating in reverse order //  +- StringAsImmutableList //  |   Used by Lists#charactersOf //  +- Values (ImmutableTable values) //      Used by return value of #values() when there are multiple cells final ImmutableListSerializer serializer = new ImmutableListSerializer ( ) ; kryo . register ( ImmutableList . class , serializer ) ; // Note: //  Only registering above is good enough for serializing/deserializing. //  but if using Kryo#copy, following is required. kryo . register ( ImmutableList . of ( ) . getClass ( ) , serializer ) ; kryo . register ( ImmutableList . of ( 1 ) . getClass ( ) , serializer ) ; kryo . register ( ImmutableList . of ( 1 , 2 , 3 , 4 ) . subList ( 1 , 3 ) . getClass ( ) , serializer ) ; kryo . register ( ImmutableList . of ( 1 , 2 ) . reverse ( ) . getClass ( ) , serializer ) ; kryo . register ( Lists . charactersOf ( "KryoRocks" ) . getClass ( ) , serializer ) ; Table < Integer , Integer , Integer > baseTable = HashBasedTable . create ( ) ; baseTable . put ( 1 , 2 , 3 ) ; baseTable . put ( 4 , 5 , 6 ) ; Table < Integer , Integer , Integer > table = ImmutableTable . copyOf ( baseTable ) ; kryo . register ( table . values ( ) . getClass ( ) , serializer ) ; }
Creates a new {@link ImmutableListSerializer} and registers its serializer
for the several ImmutableList related classes.

@param kryo the {@link Kryo} instance to set the serializer on
Creates a new { @link ImmutableListSerializer } and registers its serializer for the several ImmutableList related classes .