Use the Massive collections some more

This commit is contained in:
Olof Larsson 2018-01-19 20:51:07 +01:00
parent 213b8c79d2
commit 00983bfc94
8 changed files with 24 additions and 14 deletions

View File

@ -5,6 +5,8 @@ import com.massivecraft.massivecore.Identified;
import com.massivecraft.massivecore.MassiveException;
import com.massivecraft.massivecore.Named;
import com.massivecraft.massivecore.collections.MassiveList;
import com.massivecraft.massivecore.collections.MassiveMap;
import com.massivecraft.massivecore.collections.MassiveSet;
import com.massivecraft.massivecore.command.editor.CommandEditAbstract;
import com.massivecraft.massivecore.command.editor.CommandEditProperties;
import com.massivecraft.massivecore.command.editor.CommandEditSimple;
@ -522,7 +524,7 @@ public abstract class TypeAbstract<T> implements Type<T>
private static List<String> withoutPreAndSuffix(List<String> suggestions, String prefix)
{
LinkedHashSet<String> ret = new LinkedHashSet<>(suggestions.size());
MassiveSet<String> ret = new MassiveSet<>(suggestions.size());
boolean includesPrefix = false; // Sometimes a suggestion is equal to the prefix.
for (String suggestion : suggestions)
{

View File

@ -1,5 +1,6 @@
package com.massivecraft.massivecore.event;
import com.massivecraft.massivecore.collections.MassiveMap;
import com.massivecraft.massivecore.store.SenderColl;
import com.massivecraft.massivecore.store.SenderEntity;
import org.bukkit.event.HandlerList;
@ -32,7 +33,7 @@ public class EventMassiveCorePlayerCleanInactivityToleranceMillis extends EventM
public SenderColl<?> getColl() { return entity.getColl(); }
private final Map<String, Long> toleranceCauseMillis = new LinkedHashMap<>();
private final Map<String, Long> toleranceCauseMillis = new MassiveMap<>();
public Map<String, Long> getToleranceCauseMillis() { return this.toleranceCauseMillis; }
// -------------------------------------------- //

View File

@ -3,6 +3,7 @@ package com.massivecraft.massivecore.ps;
import com.massivecraft.massivecore.Aspect;
import com.massivecraft.massivecore.MassiveCore;
import com.massivecraft.massivecore.Multiverse;
import com.massivecraft.massivecore.collections.MassiveSet;
import com.massivecraft.massivecore.comparator.ComparatorSmart;
import com.massivecraft.massivecore.util.MUtil;
import com.massivecraft.massivecore.xlib.gson.JsonElement;
@ -863,7 +864,7 @@ public final class PS implements Serializable, Comparable<PS>
public static Set<PS> getDistinctChunks(Collection<PS> pss)
{
Set<PS> ret = new LinkedHashSet<>();
Set<PS> ret = new MassiveSet<>();
for (PS ps : pss)
{
ret.add(ps.getChunk(true));
@ -873,7 +874,7 @@ public final class PS implements Serializable, Comparable<PS>
public static Set<String> getDistinctWorlds(Collection<PS> pss)
{
Set<String> ret = new LinkedHashSet<>();
Set<String> ret = new MassiveSet<>();
for (PS ps : pss)
{
ret.add(ps.getWorld());

View File

@ -1,5 +1,7 @@
package com.massivecraft.massivecore.store;
import com.massivecraft.massivecore.collections.MassiveMap;
import com.massivecraft.massivecore.collections.MassiveSet;
import com.massivecraft.massivecore.util.DiscUtil;
import com.massivecraft.massivecore.xlib.gson.JsonObject;
import com.massivecraft.massivecore.xlib.gson.JsonParser;
@ -68,7 +70,7 @@ public class DriverFlatfile extends DriverAbstract
@Override
public Set<String> getCollnames(Db db)
{
Set<String> ret = new LinkedHashSet<>();
Set<String> ret = new MassiveSet<>();
for (File file : ((DbFlatfile)db).directory.listFiles())
{
@ -181,7 +183,7 @@ public class DriverFlatfile extends DriverAbstract
File[] files = directory.listFiles(JsonFileFilter.get());
// Create Ret
ret = new LinkedHashMap<>(files.length);
ret = new MassiveMap<>(files.length);
// For Each Found
for (File file : files)

View File

@ -1,6 +1,7 @@
package com.massivecraft.massivecore.store;
import com.massivecraft.massivecore.MassiveCoreMConf;
import com.massivecraft.massivecore.collections.MassiveMap;
import com.massivecraft.massivecore.xlib.gson.JsonObject;
import com.massivecraft.massivecore.xlib.mongodb.BasicDBObject;
import com.massivecraft.massivecore.xlib.mongodb.DB;
@ -217,7 +218,7 @@ public class DriverMongo extends DriverAbstract
try
{
// Create Ret
ret = new LinkedHashMap<>(cursor.count());
ret = new MassiveMap<>(cursor.count());
// For Each Found
while (cursor.hasNext())

View File

@ -1,5 +1,6 @@
package com.massivecraft.massivecore.store.accessor;
import com.massivecraft.massivecore.collections.MassiveMap;
import com.massivecraft.massivecore.store.EntityInternalMap;
import java.lang.reflect.Field;
@ -22,7 +23,7 @@ public class Accessor
private final Class<?> clazz;
public Class<?> getClazz() { return this.clazz; }
private Map<String, FieldAccessor> fieldToAccessor = new LinkedHashMap<>();
private Map<String, FieldAccessor> fieldToAccessor = new MassiveMap<>();
public Map<String, FieldAccessor> getFieldToAccessor() { return this.fieldToAccessor; }
public FieldAccessor getFieldAccessor(String fieldName)
@ -152,7 +153,7 @@ public class Accessor
public static Map<String, Field> getFieldMap(Class<?> clazz)
{
Map<String, Field> ret = new LinkedHashMap<>();
Map<String, Field> ret = new MassiveMap<>();
for (Field field : getFieldList(clazz))
{

View File

@ -3,6 +3,7 @@ package com.massivecraft.massivecore.util;
import com.massivecraft.massivecore.MassiveCore;
import com.massivecraft.massivecore.SenderPresence;
import com.massivecraft.massivecore.SenderType;
import com.massivecraft.massivecore.collections.MassiveSet;
import com.massivecraft.massivecore.event.EventMassiveCorePlayerLeave;
import com.massivecraft.massivecore.event.EventMassiveCoreSenderRegister;
import com.massivecraft.massivecore.event.EventMassiveCoreSenderUnregister;
@ -177,7 +178,7 @@ public class IdUtil implements Listener, Runnable
public static Set<CommandSender> getLocalSenders()
{
Set<CommandSender> ret = new LinkedHashSet<>();
Set<CommandSender> ret = new MassiveSet<>();
// Add Online Players
ret.addAll(MUtil.getOnlinePlayers());
@ -922,7 +923,7 @@ public class IdUtil implements Listener, Runnable
public static Set<IdData> getLocalPlayerDatas()
{
Set<IdData> ret = new LinkedHashSet<>();
Set<IdData> ret = new MassiveSet<>();
long millis = System.currentTimeMillis();

View File

@ -3,6 +3,7 @@ package com.massivecraft.massivecore.util;
import com.massivecraft.massivecore.MassiveCore;
import com.massivecraft.massivecore.collections.ExceptionSet;
import com.massivecraft.massivecore.collections.MassiveList;
import com.massivecraft.massivecore.collections.MassiveMap;
import com.massivecraft.massivecore.collections.MassiveSet;
import com.massivecraft.massivecore.collections.MassiveTreeSet;
import com.massivecraft.massivecore.comparator.ComparatorCaseInsensitive;
@ -1614,7 +1615,7 @@ public class MUtil
@SuppressWarnings("unchecked")
public static <K, V> Map<K, V> map(K key1, V value1, Object... objects)
{
Map<K, V> ret = new LinkedHashMap<>();
Map<K, V> ret = new MassiveMap<>();
ret.put(key1, value1);
@ -1631,7 +1632,7 @@ public class MUtil
public static <K, V> Map<V, K> flippedMap(Map<K, V> map)
{
Map<V, K> ret = new LinkedHashMap<>();
Map<V, K> ret = new MassiveMap<>();
for(Entry<K, V> entry : map.entrySet())
{
@ -1647,7 +1648,7 @@ public class MUtil
public static <K, V> Map<V, Set<K>> reverseIndex(Map<K, V> map)
{
Map<V, Set<K>> ret = new LinkedHashMap<>();
Map<V, Set<K>> ret = new MassiveMap<>();
for (Entry<K, V> entry : map.entrySet())
{