Skip to content

Commit

Permalink
Fix spotbugs
Browse files Browse the repository at this point in the history
  • Loading branch information
Shadow-Devil committed Oct 14, 2024
1 parent 5bbeff1 commit f745593
Showing 1 changed file with 6 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,9 @@ private ListOperationUtils() {}
*/
public static <K, V> Map<K, Map.Entry<V, V>> intersection(Map<K, V> mapOne, Map<K, V> mapTwo) {
Map<K, Map.Entry<V, V>> intersection = new LinkedHashMap<>();
for (K key: mapOne.keySet()) {
if (mapTwo.containsKey(key)) {
intersection.put(key, Map.entry(mapOne.get(key), mapTwo.get(key)));
for (Map.Entry<K, V> entry: mapOne.entrySet()) {
if (mapTwo.containsKey(entry.getKey())) {
intersection.put(entry.getKey(), Map.entry(entry.getValue(), mapTwo.get(entry.getKey())));
}
}
return intersection;
Expand All @@ -56,9 +56,9 @@ public static <K, V> Map<K, Map.Entry<V, V>> intersection(Map<K, V> mapOne, Map<
*/
public static <K, V> Map<K, V> union(Map<K, V> mapOne, Map<K, V> mapTwo) {
Map<K, V> union = new LinkedHashMap<>(mapOne);
for (Map.Entry<K, V> key: mapTwo.entrySet()) {
if (!mapOne.containsKey(key.getKey())) {
union.put(key.getKey(), mapTwo.get(key.getKey()));
for (Map.Entry<K, V> entry: mapTwo.entrySet()) {
if (!mapOne.containsKey(entry.getKey())) {
union.put(entry.getKey(), entry.getValue());
}
}
return union;
Expand Down

0 comments on commit f745593

Please sign in to comment.