]>
git.argeo.org Git - gpl/argeo-slc.git/blob - runtime/org.argeo.slc.support.aether/src/main/java/org/argeo/slc/aether/ArtifactIdComparator.java
2 * Copyright (C) 2007-2012 Argeo GmbH
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
16 package org
.argeo
.slc
.aether
;
18 import java
.util
.Comparator
;
19 import java
.util
.TreeMap
;
20 import java
.util
.TreeSet
;
22 import org
.sonatype
.aether
.artifact
.Artifact
;
25 * Compare two artifacts, for use in {@link TreeSet} / {@link TreeMap}, consider
26 * artifactId first THEN groupId
28 public class ArtifactIdComparator
implements Comparator
<Artifact
> {
29 public int compare(Artifact o1
, Artifact o2
) {
30 if (o1
.getArtifactId().equals(o2
.getArtifactId()))
31 return o1
.getGroupId().compareTo(o2
.getGroupId());
32 return o1
.getArtifactId().compareTo(o2
.getArtifactId());