List of usage examples for com.google.common.collect Sets newConcurrentHashSet
public static <E> Set<E> newConcurrentHashSet()
From source file:org.opendaylight.netvirt.neutronvpn.NeutronvpnUtils.java
public static void addToSubnetCache(Subnet subnet) { subnetMap.put(subnet.getUuid(), subnet); IpAddress gatewayIp = subnet.getGatewayIp(); if (gatewayIp != null) { subnetGwIpMap.computeIfAbsent(gatewayIp, k -> Sets.newConcurrentHashSet()).add(subnet.getUuid()); }/*from www. ja v a 2s . c o m*/ }
From source file:org.lanternpowered.server.world.chunk.LanternChunkManager.java
/** * Locks the chunk of the coordinates with a internal loading ticket. This * method does not trigger the loading of a chunk but locks the chunk from * unloading./*w w w. j ava 2 s . c o m*/ * * @param coords the coordinates * @return whether it was previously empty */ private boolean lockInternally(Vector2i coords, ChunkLoadingTicket ticket) { final boolean[] empty = new boolean[1]; this.ticketsByPos.computeIfAbsent(coords, coords0 -> { empty[0] = true; return Sets.newConcurrentHashSet(); }).add(ticket); return empty[0]; }
From source file:org.onosproject.driver.pipeline.ofdpa.Ofdpa2GroupHandler.java
protected void updatePendingGroups(GroupKey groupKey, GroupChainElem gce) { pendingGroups.asMap().compute(groupKey, (k, val) -> { if (val == null) { val = Sets.newConcurrentHashSet(); }/*w ww .j a va 2 s .com*/ val.add(gce); return val; }); }