Created
January 22, 2014 20:47
-
-
Save okram/8567081 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| @Test | |
| public void shouldSerializeLambda() throws Exception { | |
| ByteArrayOutputStream outBytes = new ByteArrayOutputStream(10); | |
| ObjectOutputStream out = new ObjectOutputStream(outBytes); | |
| final SerializedPredicate predicate = e -> true; | |
| out.writeObject(predicate); | |
| ObjectInputStream in = new ObjectInputStream(new ByteArrayInputStream(outBytes.toByteArray())); | |
| Predicate p = (Predicate) in.readObject(); | |
| assertTrue(p.test(null)); | |
| } | |
| public interface SerializedPredicate<T> extends Predicate<T>, Serializable { | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment