-
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
172 additions
and
0 deletions.
There are no files selected for viewing
55 changes: 55 additions & 0 deletions
55
src/main/java/de/alpharogroup/collection/comparators/KeyMapPairKeyComparator.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
/** | ||
* The MIT License | ||
* | ||
* Copyright (C) 2015 Asterios Raptis | ||
* | ||
* Permission is hereby granted, free of charge, to any person obtaining | ||
* a copy of this software and associated documentation files (the | ||
* "Software"), to deal in the Software without restriction, including | ||
* without limitation the rights to use, copy, modify, merge, publish, | ||
* distribute, sublicense, and/or sell copies of the Software, and to | ||
* permit persons to whom the Software is furnished to do so, subject to | ||
* the following conditions: | ||
* | ||
* The above copyright notice and this permission notice shall be | ||
* included in all copies or substantial portions of the Software. | ||
* | ||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, | ||
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF | ||
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND | ||
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE | ||
* LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION | ||
* OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION | ||
* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. | ||
*/ | ||
package de.alpharogroup.collection.comparators; | ||
|
||
import java.util.Comparator; | ||
|
||
import de.alpharogroup.collections.pairs.KeyMapPair; | ||
|
||
/** | ||
* The class {@link KeyMapPairKeyComparator} compares {@linkplain KeyMapPair} objects over the key | ||
* where the key have to implements the {@linkplain Comparable} interface. | ||
* | ||
* @param <K> | ||
* The type of the key. | ||
* @param <MK> | ||
* the generic type of the map key. | ||
* @param <MV> | ||
* the generic type of the map value. | ||
*/ | ||
public class KeyMapPairKeyComparator<K extends Comparable<K>, MK, MV> | ||
implements | ||
Comparator<KeyMapPair<K, MK, MV>> | ||
{ | ||
|
||
/** | ||
* {@inheritDoc} | ||
*/ | ||
@Override | ||
public int compare(final KeyMapPair<K, MK, MV> o1, final KeyMapPair<K, MK, MV> o2) | ||
{ | ||
return o1.getKey().compareTo(o2.getKey()); | ||
} | ||
} |
53 changes: 53 additions & 0 deletions
53
src/main/java/de/alpharogroup/collection/comparators/KeyValuePairKeyComparator.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
/** | ||
* The MIT License | ||
* | ||
* Copyright (C) 2015 Asterios Raptis | ||
* | ||
* Permission is hereby granted, free of charge, to any person obtaining | ||
* a copy of this software and associated documentation files (the | ||
* "Software"), to deal in the Software without restriction, including | ||
* without limitation the rights to use, copy, modify, merge, publish, | ||
* distribute, sublicense, and/or sell copies of the Software, and to | ||
* permit persons to whom the Software is furnished to do so, subject to | ||
* the following conditions: | ||
* | ||
* The above copyright notice and this permission notice shall be | ||
* included in all copies or substantial portions of the Software. | ||
* | ||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, | ||
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF | ||
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND | ||
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE | ||
* LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION | ||
* OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION | ||
* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. | ||
*/ | ||
package de.alpharogroup.collection.comparators; | ||
|
||
import java.util.Comparator; | ||
|
||
import de.alpharogroup.collections.pairs.KeyValuePair; | ||
|
||
/** | ||
* The class {@link KeyValuePairKeyComparator} compares {@linkplain KeyValuePair} objects over the | ||
* key where the key have to implements the {@linkplain Comparable} interface. | ||
* | ||
* @param <K> | ||
* The generic type of the key | ||
* @param <V> | ||
* The generic type of the value | ||
*/ | ||
public class KeyValuePairKeyComparator<K extends Comparable<K>, V> | ||
implements | ||
Comparator<KeyValuePair<K, V>> | ||
{ | ||
|
||
/** | ||
* {@inheritDoc} | ||
*/ | ||
@Override | ||
public int compare(final KeyValuePair<K, V> o1, final KeyValuePair<K, V> o2) | ||
{ | ||
return o1.getKey().compareTo(o2.getKey()); | ||
} | ||
} |
53 changes: 53 additions & 0 deletions
53
src/main/java/de/alpharogroup/collection/comparators/KeyValuesPairKeyComparator.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
/** | ||
* The MIT License | ||
* | ||
* Copyright (C) 2015 Asterios Raptis | ||
* | ||
* Permission is hereby granted, free of charge, to any person obtaining | ||
* a copy of this software and associated documentation files (the | ||
* "Software"), to deal in the Software without restriction, including | ||
* without limitation the rights to use, copy, modify, merge, publish, | ||
* distribute, sublicense, and/or sell copies of the Software, and to | ||
* permit persons to whom the Software is furnished to do so, subject to | ||
* the following conditions: | ||
* | ||
* The above copyright notice and this permission notice shall be | ||
* included in all copies or substantial portions of the Software. | ||
* | ||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, | ||
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF | ||
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND | ||
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE | ||
* LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION | ||
* OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION | ||
* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. | ||
*/ | ||
package de.alpharogroup.collection.comparators; | ||
|
||
import java.util.Comparator; | ||
|
||
import de.alpharogroup.collections.pairs.KeyValuesPair; | ||
|
||
/** | ||
* The class {@link KeyValuesPairKeyComparator} compares {@linkplain KeyValuesPair} objects over the | ||
* key where the key have to implements the {@linkplain Comparable} interface. | ||
* | ||
* @param <K> | ||
* The generic type of the key | ||
* @param <V> | ||
* The generic type of the value | ||
*/ | ||
public class KeyValuesPairKeyComparator<K extends Comparable<K>, V> | ||
implements | ||
Comparator<KeyValuesPair<K, V>> | ||
{ | ||
|
||
/** | ||
* {@inheritDoc} | ||
*/ | ||
@Override | ||
public int compare(final KeyValuesPair<K, V> o1, final KeyValuesPair<K, V> o2) | ||
{ | ||
return o1.getKey().compareTo(o2.getKey()); | ||
} | ||
} |
11 changes: 11 additions & 0 deletions
11
src/main/java/de/alpharogroup/collection/comparators/package.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> | ||
<html> | ||
<head> | ||
<title> | ||
de.alpharogroup.comparators | ||
</title> | ||
</head> | ||
<body> | ||
This package contains common comparators | ||
</body> | ||
</html> |