com.volcengine.util.NameValueComparator Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of volc-sdk-java Show documentation
Show all versions of volc-sdk-java Show documentation
The VOLC Engine SDK for Java
package com.volcengine.util;
import org.apache.http.NameValuePair;
import java.util.Comparator;
public enum NameValueComparator implements Comparator {
INSTANCE;
private final static boolean NULL_FIRST = false;
@Override
public int compare(NameValuePair o1, NameValuePair o2) {
if (o1.getName() == null) {
return (o2.getName() == null) ? 0 : (NULL_FIRST ? -1 : 1);
} else if (o2.getName() == null) {
return NULL_FIRST ? 1: -1;
} else {
return o1.getName().compareTo(o2.getName());
}
}
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy