Example usage for com.google.common.collect ComparisonChain start

List of usage examples for com.google.common.collect ComparisonChain start

Introduction

In this page you can find the example usage for com.google.common.collect ComparisonChain start.

Prototype

public static ComparisonChain start() 

Source Link

Document

Begins a new chained comparison statement.

Usage

From source file:uk.co.caprica.brue.core.domain.bridge.Rule.java

@Override
public int compareTo(Rule another) {
    return ComparisonChain.start().compare(name, another.name, Ordering.natural().nullsLast())
            .compare(owner, another.owner).result();
}

From source file:org.spongepowered.api.data.manipulator.immutable.common.AbstractImmutableMappedData.java

@Override
public int compareTo(I o) {
    final Map<K, V> thisMap = getValue();
    final Map<K, V> otherMap = o.asMap();
    final Set<K> thisKeySet = thisMap.keySet();
    final Set<K> otherKeySet = otherMap.keySet();
    final Collection<V> thisValueSet = thisMap.values();
    final Collection<V> otherValueSet = otherMap.values();
    return ComparisonChain.start()
            .compare(thisKeySet.containsAll(otherKeySet), otherKeySet.containsAll(thisKeySet))
            .compare(thisValueSet.containsAll(otherValueSet), otherValueSet.containsAll(thisValueSet)).result();
}

From source file:fr.putnami.pwt.doc.client.page.sample.domain.Person.java

@Override
public int compareTo(Person o) {
    if (o != null) {
        return ComparisonChain.start().compare(name, o.name).result();
    }/*  www.jav  a 2 s.  co  m*/
    return 1;
}

From source file:org.jclouds.aws.ec2.domain.Tag.java

@Override
public int compareTo(Tag t) {
    return ComparisonChain.start().compare(resourceId, t.resourceId).compare(resourceType, t.resourceType)
            .compare(key, t.key).compare(value, t.value).result();
}

From source file:org.onlab.util.Bandwidth.java

@Override
public int compareTo(Bandwidth other) {
    return ComparisonChain.start().compare(this.bps, other.bps).result();
}

From source file:org.graylog2.streams.StreamListFingerprint.java

private int comparisonResult(String id1, String id2) {
    return ComparisonChain.start().compare(id1, id2, String.CASE_INSENSITIVE_ORDER).compare(id1, id2).result();
}

From source file:com.nearinfinity.honeycomb.hbase.rowkey.DataRowKey.java

@Override
public int compareTo(RowKey o) {
    int typeCompare = getPrefix() - o.getPrefix();
    if (typeCompare != 0) {
        return typeCompare;
    }/* www . j  ava  2s .  c om*/
    DataRowKey row2 = (DataRowKey) o;
    return ComparisonChain.start().compare(getTableId(), row2.getTableId()).compare(Util.UUIDToBytes(getUuid()),
            Util.UUIDToBytes(row2.getUuid()), new Bytes.ByteArrayComparator()).result();
}

From source file:org.apache.brooklyn.rest.domain.BundleSummary.java

@Override
public int compareTo(BundleSummary o2) {
    BundleSummary o1 = this;
    return ComparisonChain.start().compare(o1.symbolicName, o2.symbolicName, NaturalOrderComparator.INSTANCE)
            .compare(o2.version, o1.version, VersionComparator.INSTANCE).result();
}

From source file:org.spongepowered.common.data.manipulator.immutable.entity.ImmutableSpongeBreathingData.java

@Override
public int compareTo(ImmutableBreathingData o) {
    return ComparisonChain.start().compare(o.maxAir().get().intValue(), this.maxAir)
            .compare(o.remainingAir().get().intValue(), this.remainingAir).result();
}

From source file:com.github.hilcode.versionator.maven.GroupArtifact.java

@Override
public int compareTo(final GroupArtifact other) {
    return ComparisonChain.start().compare(this.groupId.toLowerCase(), other.groupId.toLowerCase())
            .compare(this.artifactId.toLowerCase(), other.artifactId.toLowerCase()).result();
}