本文整理匯總了Java中org.apache.commons.lang3.builder.CompareToBuilder類的典型用法代碼示例。如果您正苦於以下問題:Java CompareToBuilder類的具體用法?Java CompareToBuilder怎麽用?Java CompareToBuilder使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
CompareToBuilder類屬於org.apache.commons.lang3.builder包,在下文中一共展示了CompareToBuilder類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: compareToBuilderIsNOTScalarized
import org.apache.commons.lang3.builder.CompareToBuilder; //導入依賴的package包/類
@Test
public void compareToBuilderIsNOTScalarized() throws Exception {
assertThat(
new Scenario() {
@Override
public long run() {
return new CompareToBuilder()
.append( "34543", "34543" )
.append( true, true )
.append( 'A', 'A' )
.append( 1.45f, 1.5f )
.toComparison();
}
},
finallyAllocatesSomething()
);
}
示例2: findFileList
import org.apache.commons.lang3.builder.CompareToBuilder; //導入依賴的package包/類
private List<TranscriptFileInfo> findFileList(TranscriptService tserv, String user, List<State> states) {
List<TranscriptFileInfo> files = new ArrayList<TranscriptFileInfo>();
//Just grab all the files - note that we don't care about duplicates
for(State state: states) {
Map<String, List<TranscriptFileInfo>> found = tserv.findAllFiles(user, state, null);
for(List<TranscriptFileInfo> oneList: found.values()) {
files.addAll(oneList);
}
}
//Now sort
Collections.sort(files, new Comparator<TranscriptFileInfo>(){
@Override
public int compare(TranscriptFileInfo lhs, TranscriptFileInfo rhs) {
return new CompareToBuilder()
.append(lhs.getFileName(), rhs.getFileName(), String.CASE_INSENSITIVE_ORDER)
.append(lhs.getState().ordinal(), rhs.getState().ordinal())
.toComparison();
}
});
return files;
}
示例3: fetchAllInColumn
import org.apache.commons.lang3.builder.CompareToBuilder; //導入依賴的package包/類
public List<CardFullWithCounts> fetchAllInColumn(int columnId) {
List<CardFull> cards = cardRepository.findAllByColumnId(columnId);
if (cards.isEmpty()) {
return Collections.emptyList();
}
List<CardFullWithCounts> res = fetchCardFull(cards);
Collections.sort(res, new Comparator<CardFullWithCounts>() {
@Override
public int compare(CardFullWithCounts o1, CardFullWithCounts o2) {
return new CompareToBuilder().append(o1.getOrder(), o2.getOrder()).toComparison();
}
});
//
return res;
}
示例4: compareTo
import org.apache.commons.lang3.builder.CompareToBuilder; //導入依賴的package包/類
@Override
public int compareTo(AddressFamilyRoutingConfiguration o) {
CompareToBuilder builder = (new CompareToBuilder())
.append(getKey(), o.getKey())
.append(getRoutes().size(), o.getRoutes().size());
if(builder.toComparison() == 0) {
Iterator<RouteConfiguration> lit = getRoutes().iterator();
Iterator<RouteConfiguration> rit = o.getRoutes().iterator();
while(lit.hasNext())
builder.append(lit.next(), rit.next());
}
return builder.toComparison();
}
示例5: compareTo
import org.apache.commons.lang3.builder.CompareToBuilder; //導入依賴的package包/類
@Override
public int compareTo(PathAttributeConfiguration o) {
CompareToBuilder builder = new CompareToBuilder();
builder.append(getAttributes().size(), o.getAttributes().size());
if(builder.toComparison() == 0) {
Iterator<PathAttribute> lit = getAttributes().iterator();
Iterator<PathAttribute> rit = o.getAttributes().iterator();
while(lit.hasNext())
builder.append(lit.next(), rit.next());
}
return builder.toComparison();
}
示例6: compareToSubclass
import org.apache.commons.lang3.builder.CompareToBuilder; //導入依賴的package包/類
@Override
protected int compareToSubclass(Capability other) {
OutboundRouteFilteringCapability orc = (OutboundRouteFilteringCapability)other;
CompareToBuilder builder = new CompareToBuilder();
builder.append(getAddressFamily(), orc.getAddressFamily())
.append(getSubsequentAddressFamily(), orc.getSubsequentAddressFamily())
.append(getFilters().size(), orc.getFilters()
.size());
if(builder.toComparison() != 0)
return builder.toComparison();
Iterator<ORFType> hSet = getFilters().keySet().iterator();
Iterator<ORFType> oSet = orc.getFilters().keySet().iterator();
while(hSet.hasNext()) {
ORFType hType = hSet.next();
ORFType oType = oSet.next();
builder.append(hType, oType).append(getFilters().get(hType), orc.getFilters().get(oType));
}
return builder.toComparison();
}
示例7: subclassCompareTo
import org.apache.commons.lang3.builder.CompareToBuilder; //導入依賴的package包/類
@Override
protected int subclassCompareTo(PathAttribute obj) {
ASPathAttribute o = (ASPathAttribute)obj;
CompareToBuilder builder = (new CompareToBuilder())
.append(getAsType(), o.getAsType())
.append(getPathSegments().size(), o.getPathSegments().size());
if(builder.toComparison() == 0) {
Iterator<PathSegment> lit = getPathSegments().iterator();
Iterator<PathSegment> rit = o.getPathSegments().iterator();
while(lit.hasNext())
builder.append(lit.next(), rit.next());
}
return builder.toComparison();
}
示例8: subclassCompareTo
import org.apache.commons.lang3.builder.CompareToBuilder; //導入依賴的package包/類
@Override
protected int subclassCompareTo(PathAttribute obj) {
MultiProtocolNLRI o = (MultiProtocolNLRI)obj;
CompareToBuilder builer = (new CompareToBuilder())
.append(getPathAttributeType(), o.getPathAttributeType())
.append(getAddressFamily(), o.getAddressFamily())
.append(getSubsequentAddressFamily(), o.getSubsequentAddressFamily())
.append(getNextHop(), o.getNextHop())
.append(getNlris().size(), o.getNlris().size());
if(builer.toComparison() == 0) {
Iterator<MultiProtocolNLRIInformation> lit = getNlris().iterator();
Iterator<MultiProtocolNLRIInformation> rit = o.getNlris().iterator();
while(lit.hasNext())
builer.append(lit.next(), rit.next());
}
return builer.toComparison();
}
示例9: subclassCompareTo
import org.apache.commons.lang3.builder.CompareToBuilder; //導入依賴的package包/類
@Override
protected int subclassCompareTo(PathAttribute obj) {
CommunityPathAttribute o = (CommunityPathAttribute)obj;
CompareToBuilder builder = (new CompareToBuilder())
.append(getCommunity(), o.getCommunity())
.append(getMembers().size(), o.getMembers().size());
if(builder.toComparison() == 0) {
Iterator<CommunityMember> lit = getMembers().iterator();
Iterator<CommunityMember> rit = o.getMembers().iterator();
while(lit.hasNext())
builder.append(lit.next(), rit.next());
}
return builder.toComparison();
}
示例10: subclassCompareTo
import org.apache.commons.lang3.builder.CompareToBuilder; //導入依賴的package包/類
@Override
protected int subclassCompareTo(PathAttribute obj) {
CompareToBuilder builder = new CompareToBuilder();
ClusterListPathAttribute o = (ClusterListPathAttribute)obj;
builder.append(getClusterIds().size(), o.getClusterIds().size());
if(builder.toComparison() == 0) {
Iterator<Integer> lit = getClusterIds().iterator();
Iterator<Integer> rit = o.getClusterIds().iterator();
while(lit.hasNext())
builder.append(lit.next(), rit.next());
}
return builder.toComparison();
}
示例11: compareTo
import org.apache.commons.lang3.builder.CompareToBuilder; //導入依賴的package包/類
@Override
public int compareTo(PathSegment o) {
CompareToBuilder builder = (new CompareToBuilder())
.append(getAsType(), o.getAsType())
.append(getPathSegmentType(), o.getPathSegmentType())
.append(getAses().size(), o.getAses().size());
if(builder.toComparison() == 0) {
Iterator<Integer> lit = getAses().iterator();
Iterator<Integer> rit = o.getAses().iterator();
while(lit.hasNext())
builder.append(lit.next(), rit.next());
}
return builder.toComparison();
}
示例12: compareTo
import org.apache.commons.lang3.builder.CompareToBuilder; //導入依賴的package包/類
public int compareTo(EmployeeFreeSequence other) {
return new CompareToBuilder()
.append(employee, other.employee)
.append(firstDayIndex, other.firstDayIndex)
.append(lastDayIndex, other.lastDayIndex)
.toComparison();
}
示例13: compareTo
import org.apache.commons.lang3.builder.CompareToBuilder; //導入依賴的package包/類
public int compareTo(EmployeeWeekendSequence other) {
return new CompareToBuilder()
.append(employee, other.employee)
.append(firstSundayIndex, other.firstSundayIndex)
.append(lastSundayIndex, other.lastSundayIndex)
.toComparison();
}
示例14: compareTo
import org.apache.commons.lang3.builder.CompareToBuilder; //導入依賴的package包/類
public int compareTo(EmployeeWorkSequence other) {
return new CompareToBuilder()
.append(employee, other.employee)
.append(firstDayIndex, other.firstDayIndex)
.append(lastDayIndex, other.lastDayIndex)
.toComparison();
}
示例15: compare
import org.apache.commons.lang3.builder.CompareToBuilder; //導入依賴的package包/類
public int compare(Employee a, Employee b) {
// TODO refactor to DifficultyWeightFactory and use getContract().getContractLineList()
// to sum maximumValue and minimumValue etc
return new CompareToBuilder()
.append(b.getWeekendLength(), a.getWeekendLength()) // Descending
// .append(a.getId(), b.getId())
.toComparison();
}