From 9f717384a4130cba4d4ec0297a8ff6c1bcc965e4 Mon Sep 17 00:00:00 2001 From: Jonathan Wood Date: Wed, 24 Jun 2015 22:14:42 -0700 Subject: [PATCH] Don't use java.util.function.Predicate. It is a Java-8 addition. --- .../com/moandjiezana/toml/ObjectSerializer.java | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/src/main/java/com/moandjiezana/toml/ObjectSerializer.java b/src/main/java/com/moandjiezana/toml/ObjectSerializer.java index ffe106c..07da595 100644 --- a/src/main/java/com/moandjiezana/toml/ObjectSerializer.java +++ b/src/main/java/com/moandjiezana/toml/ObjectSerializer.java @@ -3,7 +3,6 @@ package com.moandjiezana.toml; import java.lang.reflect.Field; import java.lang.reflect.Modifier; import java.util.*; -import java.util.function.Predicate; import static com.moandjiezana.toml.MapSerializer.MAP_SERIALIZER; @@ -42,14 +41,14 @@ class ObjectSerializer implements Serializer { getSuperClassFields(cls.getSuperclass(), fields); // Skip final fields - fields.removeIf(new Predicate() { - @Override - public boolean test(Field field) { - return Modifier.isFinal(field.getModifiers()); + Set prunedFields = new LinkedHashSet(); + for (Field field : fields) { + if (!Modifier.isFinal(field.getModifiers())) { + prunedFields.add(field); } - }); + } - return fields; + return prunedFields; } static private void getSuperClassFields(Class cls, Set fields) {