aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/org/traccar/web
diff options
context:
space:
mode:
authorAnton Tananaev <anton.tananaev@gmail.com>2020-10-18 14:32:51 -0700
committerGitHub <noreply@github.com>2020-10-18 14:32:51 -0700
commit0d5dd20257ab5a4c77ff628b67e6d54931d8ae16 (patch)
tree9c5be8d286ef0f2244329d60385e9e8f1fef6fbd /src/main/java/org/traccar/web
parenta9f5599a1ae18279339a7ff17058d40b9ed4fab4 (diff)
parent3ad889413e4b13d2dd6a2aa6454964dd9427fb28 (diff)
downloadtrackermap-server-0d5dd20257ab5a4c77ff628b67e6d54931d8ae16.tar.gz
trackermap-server-0d5dd20257ab5a4c77ff628b67e6d54931d8ae16.tar.bz2
trackermap-server-0d5dd20257ab5a4c77ff628b67e6d54931d8ae16.zip
Merge pull request #4584 from kamaci/master
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.java19
1 files changed, 8 insertions, 11 deletions
diff --git a/src/main/java/org/traccar/web/CsvBuilder.java b/src/main/java/org/traccar/web/CsvBuilder.java
index 3fe7e408f..b962be072 100644
--- a/src/main/java/org/traccar/web/CsvBuilder.java
+++ b/src/main/java/org/traccar/web/CsvBuilder.java
@@ -21,7 +21,6 @@ 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;
@@ -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;