Example usage for org.apache.wicket.util.collections MiniMap entrySet

List of usage examples for org.apache.wicket.util.collections MiniMap entrySet

Introduction

In this page you can find the example usage for org.apache.wicket.util.collections MiniMap entrySet.

Prototype

@Override
public Set<Entry<K, V>> entrySet() 

Source Link

Usage

From source file:de.javakaffee.kryoserializers.wicket.MiniMapSerializer.java

License:Apache License

@Override
public void write(final Kryo kryo, final Output output, final MiniMap<Object, Object> map) {
    output.writeInt(getMaxEntries(map), true);
    output.writeInt(map.size(), true);/*from   ww w.  j a  v  a2 s  .c  o  m*/

    for (final Entry<?, ?> entry : map.entrySet()) {
        kryo.writeClassAndObject(output, entry.getKey());
        kryo.writeClassAndObject(output, entry.getValue());
    }

    if (TRACE)
        trace("kryo", "Wrote map: " + map);
}

From source file:de.javakaffee.kryoserializers.wicket.MiniMapSerializerTest.java

License:Apache License

@Test(enabled = true)
public void testMiniMapExactNumberOfEntries() {
    final MiniMap<String, String> obj = new MiniMap<String, String>(1);
    obj.put("foo", "bar");
    final byte[] serialized = serialize(_kryo, obj);
    final MiniMap<?, ?> deserialized = deserialize(_kryo, serialized, MiniMap.class);
    Assert.assertEquals(deserialized.size(), obj.size());
    final Entry<?, ?> deserializedNext = deserialized.entrySet().iterator().next();
    final Entry<?, ?> origNext = obj.entrySet().iterator().next();
    Assert.assertEquals(deserializedNext.getKey(), origNext.getKey());
    Assert.assertEquals(deserializedNext.getValue(), origNext.getValue());
}