diff options
author | kamaci <furkankamaci@gmail.com> | 2020-10-19 00:01:12 +0300 |
---|---|---|
committer | kamaci <furkankamaci@gmail.com> | 2020-10-19 00:01:12 +0300 |
commit | 3cd7831692b1725713e297372a0181e5ae614eb9 (patch) | |
tree | 46725cd3575e53ff9ff40b44236b34a323f804ac /src/main/java/org/traccar/web | |
parent | 98c2e3da5ea0670360078a3f278ddef7d9e39953 (diff) | |
download | trackermap-server-3cd7831692b1725713e297372a0181e5ae614eb9.tar.gz trackermap-server-3cd7831692b1725713e297372a0181e5ae614eb9.tar.bz2 trackermap-server-3cd7831692b1725713e297372a0181e5ae614eb9.zip |
Anonymous types are replaced with lambda.
Diffstat (limited to 'src/main/java/org/traccar/web')
-rw-r--r-- | src/main/java/org/traccar/web/CsvBuilder.java | 31 |
1 files changed, 14 insertions, 17 deletions
diff --git a/src/main/java/org/traccar/web/CsvBuilder.java b/src/main/java/org/traccar/web/CsvBuilder.java index 3fe7e408f..2efe2adde 100644 --- a/src/main/java/org/traccar/web/CsvBuilder.java +++ b/src/main/java/org/traccar/web/CsvBuilder.java @@ -16,23 +16,22 @@ */ package org.traccar.web; +import com.fasterxml.jackson.core.JsonProcessingException; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.traccar.Context; +import org.traccar.helper.DateUtil; + import java.beans.Introspector; import java.lang.reflect.InvocationTargetException; import java.lang.reflect.Method; import java.util.Arrays; import java.util.Collection; -import java.util.Comparator; import java.util.Date; import java.util.Map; import java.util.SortedSet; import java.util.TreeSet; -import com.fasterxml.jackson.core.JsonProcessingException; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.traccar.Context; -import org.traccar.helper.DateUtil; - public class CsvBuilder { private static final Logger LOGGER = LoggerFactory.getLogger(CsvBuilder.class); @@ -45,23 +44,21 @@ public class CsvBuilder { private void addLineEnding() { builder.append(LINE_ENDING); } + private void addSeparator() { builder.append(SEPARATOR); } private SortedSet<Method> getSortedMethods(Object object) { Method[] methodArray = object.getClass().getMethods(); - SortedSet<Method> methods = new TreeSet<>(new Comparator<Method>() { - @Override - public int compare(Method m1, Method m2) { - if (m1.getName().equals("getAttributes") && !m1.getName().equals(m2.getName())) { - return 1; - } - if (m2.getName().equals("getAttributes") && !m1.getName().equals(m2.getName())) { - return -1; - } - return m1.getName().compareTo(m2.getName()); + SortedSet<Method> methods = new TreeSet<>((m1, m2) -> { + if (m1.getName().equals("getAttributes") && !m1.getName().equals(m2.getName())) { + return 1; + } + if (m2.getName().equals("getAttributes") && !m1.getName().equals(m2.getName())) { + return -1; } + return m1.getName().compareTo(m2.getName()); }); methods.addAll(Arrays.asList(methodArray)); return methods; |