mirror of
https://github.com/LuckPerms/LuckPerms.git
synced 2024-11-28 05:35:26 +01:00
Fix compat with older guava versions
This commit is contained in:
parent
83b0f62d59
commit
cd7b3b4f6e
@ -30,7 +30,6 @@ import com.google.common.collect.Multimap;
|
|||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
import java.util.stream.Collectors;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* An immutable implementation of {@link ContextSet}.
|
* An immutable implementation of {@link ContextSet}.
|
||||||
@ -71,13 +70,12 @@ public final class ImmutableContextSet implements ContextSet {
|
|||||||
throw new NullPointerException("map");
|
throw new NullPointerException("map");
|
||||||
}
|
}
|
||||||
|
|
||||||
return new ImmutableContextSet(ImmutableMultimap.copyOf(
|
ImmutableMultimap.Builder<String, String> b = ImmutableMultimap.builder();
|
||||||
map.entrySet().stream()
|
for (Map.Entry<String, String> e : map.entrySet()) {
|
||||||
.collect(Collectors.toMap(
|
b.put(e.getKey(), e.getValue());
|
||||||
e -> e.getKey().toLowerCase(),
|
}
|
||||||
Map.Entry::getValue
|
|
||||||
)).entrySet()
|
return new ImmutableContextSet(b.build());
|
||||||
));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -160,7 +158,12 @@ public final class ImmutableContextSet implements ContextSet {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Map<String, String> toMap() {
|
public Map<String, String> toMap() {
|
||||||
return ImmutableMap.copyOf(map.entries());
|
ImmutableMap.Builder<String, String> m = ImmutableMap.builder();
|
||||||
|
for (Map.Entry<String, String> e : map.entries()) {
|
||||||
|
m.put(e.getKey(), e.getValue());
|
||||||
|
}
|
||||||
|
|
||||||
|
return m.build();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -168,7 +168,12 @@ public final class MutableContextSet implements ContextSet {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Map<String, String> toMap() {
|
public Map<String, String> toMap() {
|
||||||
return ImmutableMap.copyOf(map.entries());
|
ImmutableMap.Builder<String, String> m = ImmutableMap.builder();
|
||||||
|
for (Map.Entry<String, String> e : map.entries()) {
|
||||||
|
m.put(e.getKey(), e.getValue());
|
||||||
|
}
|
||||||
|
|
||||||
|
return m.build();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
Loading…
Reference in New Issue
Block a user