diff --git a/collections/src/main/java/com/gs/collections/impl/tuple/AbstractImmutableEntry.java b/collections/src/main/java/com/gs/collections/impl/tuple/AbstractImmutableEntry.java index bfc5b0d3e..ae76e6243 100644 --- a/collections/src/main/java/com/gs/collections/impl/tuple/AbstractImmutableEntry.java +++ b/collections/src/main/java/com/gs/collections/impl/tuple/AbstractImmutableEntry.java @@ -1,5 +1,5 @@ /* - * Copyright 2014 Goldman Sachs. + * Copyright 2015 Goldman Sachs. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -21,12 +21,11 @@ import com.gs.collections.api.block.function.Function; import com.gs.collections.api.tuple.Pair; +import com.gs.collections.impl.block.factory.Functions; public class AbstractImmutableEntry implements Map.Entry, Serializable { private static final long serialVersionUID = 1L; - private static final KeyFunction TO_KEY = new KeyFunction(); - private static final ValueFunction TO_VALUE = new ValueFunction(); private static final PairFunction TO_PAIR = new PairFunction(); protected final K key; @@ -38,14 +37,22 @@ public AbstractImmutableEntry(K key, V value) this.value = value; } + /** + * @deprecated Since 6.2 - Use {@link Functions#getKeyFunction()} instead. + */ + @Deprecated public static Function, K> getKeyFunction() { - return (Function, K>) (Function) TO_KEY; + return Functions.getKeyFunction(); } + /** + * @deprecated Since 6.2 - Use {@link Functions#getValueFunction()} instead. + */ + @Deprecated public static Function, V> getValueFunction() { - return (Function, V>) (Function) TO_VALUE; + return Functions.getValueFunction(); } public static Function, Pair> getPairFunction() @@ -83,6 +90,10 @@ public String toString() return this.key + "=" + this.value; } + /** + * @deprecated Since 6.2 - Kept for serialization compatibility only. + */ + @Deprecated private static class KeyFunction implements Function, K> { private static final long serialVersionUID = 1L; @@ -93,6 +104,10 @@ public K valueOf(Map.Entry entry) } } + /** + * @deprecated Since 6.2 - Kept for serialization compatibility only. + */ + @Deprecated private static class ValueFunction implements Function, V> { private static final long serialVersionUID = 1L; diff --git a/serialization-tests/src/test/java/com/gs/collections/impl/tuple/AbstractImmutableEntrySerializationTest.java b/serialization-tests/src/test/java/com/gs/collections/impl/tuple/AbstractImmutableEntrySerializationTest.java index 3b91d3f69..0ae382a3e 100644 --- a/serialization-tests/src/test/java/com/gs/collections/impl/tuple/AbstractImmutableEntrySerializationTest.java +++ b/serialization-tests/src/test/java/com/gs/collections/impl/tuple/AbstractImmutableEntrySerializationTest.java @@ -1,5 +1,5 @@ /* - * Copyright 2011 Goldman Sachs. + * Copyright 2015 Goldman Sachs. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -21,26 +21,6 @@ public class AbstractImmutableEntrySerializationTest { - @Test - public void getKeyFunction() - { - Verify.assertSerializedForm( - 1L, - "rO0ABXNyAEBjb20uZ3MuY29sbGVjdGlvbnMuaW1wbC50dXBsZS5BYnN0cmFjdEltbXV0YWJsZUVu\n" - + "dHJ5JEtleUZ1bmN0aW9uAAAAAAAAAAECAAB4cA==", - AbstractImmutableEntry.getKeyFunction()); - } - - @Test - public void getValueFunction() - { - Verify.assertSerializedForm( - 1L, - "rO0ABXNyAEJjb20uZ3MuY29sbGVjdGlvbnMuaW1wbC50dXBsZS5BYnN0cmFjdEltbXV0YWJsZUVu\n" - + "dHJ5JFZhbHVlRnVuY3Rpb24AAAAAAAAAAQIAAHhw", - AbstractImmutableEntry.getValueFunction()); - } - @Test public void getPairFunction() {