]> jfr.im git - irc/rizon/acid.git/commitdiff
use LinkedHashMap instead of HashMap for channelMap as well as provide an interface...
authorchristinaa <redacted>
Tue, 29 Aug 2017 08:34:31 +0000 (01:34 -0700)
committerchristinaa <redacted>
Tue, 29 Aug 2017 08:34:31 +0000 (01:34 -0700)
acid/src/main/java/net/rizon/acid/core/Channel.java

index 3e0c6b1d2ceed81a9328fd49bcda2646a54f4b5b..4ecf32ecbb939bbd798de88c6878578d4af8d94d 100644 (file)
@@ -249,6 +249,18 @@ public class Channel
                Acidictive.reply(target, to, c, "Listed " + (owners.size() + admins.size() + ops.size() + hops.size() + voices.size() + regs.size()) + " users that are currently in " + channel);
        }
 
+       /*
+        * LinkedHashMap has a slight advantage when it comes to lookup and value based iteration
+        * which makes it more suitable for things that operate exclusively on all Channel objects
+        * instead of looking up specific channels by key. (there's a few in Geo & friends).
+        */
+       private static LinkedHashMap<String, Channel> channelMap = new LinkedHashMap<String, Channel>();
+
+       public static Collection<Channel> getChannelList()
+       {
+               return channelMap.values();
+       }
+
        public static Set<String> getChannels()
        {
                return channelMap.keySet();