Java Code Examples for com.google.common.collect.LinkedListMultimap#putAll()

The following examples show how to use com.google.common.collect.LinkedListMultimap#putAll() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: TestBlockManager.java    From hadoop with Apache License 2.0 5 votes vote down vote up
private LinkedListMultimap<DatanodeStorageInfo, BlockTargetPair> getAllPendingReplications() {
  LinkedListMultimap<DatanodeStorageInfo, BlockTargetPair> repls =
    LinkedListMultimap.create();
  for (DatanodeDescriptor dn : nodes) {
    List<BlockTargetPair> thisRepls = dn.getReplicationCommand(10);
    if (thisRepls != null) {
      for(DatanodeStorageInfo storage : dn.getStorageInfos()) {
        repls.putAll(storage, thisRepls);
      }
    }
  }
  return repls;
}
 
Example 2
Source File: TestBlockManager.java    From big-c with Apache License 2.0 5 votes vote down vote up
private LinkedListMultimap<DatanodeStorageInfo, BlockTargetPair> getAllPendingReplications() {
  LinkedListMultimap<DatanodeStorageInfo, BlockTargetPair> repls =
    LinkedListMultimap.create();
  for (DatanodeDescriptor dn : nodes) {
    List<BlockTargetPair> thisRepls = dn.getReplicationCommand(10);
    if (thisRepls != null) {
      for(DatanodeStorageInfo storage : dn.getStorageInfos()) {
        repls.putAll(storage, thisRepls);
      }
    }
  }
  return repls;
}
 
Example 3
Source File: ChunkLoading.java    From enderutilities with GNU Lesser General Public License v3.0 5 votes vote down vote up
@Override
public ListMultimap<String, Ticket> playerTicketsLoaded(ListMultimap<String, Ticket> tickets, World world)
{
    Multimap<String, Ticket> persistentPlayerTickets = HashMultimap.create();
    LinkedListMultimap<String, Ticket> claimedTickets = LinkedListMultimap.create();

    //int i = 0;
    for (String player : tickets.keys())
    {
        //System.out.println("playerTicketsLoaded(): looping outer start: " + i);
        for (Ticket ticket : tickets.get(player))
        {
            if (ticket != null)
            {
                /*if (ticket.world != null && ticket.world.provider != null) { System.out.println("playerTicketsLoaded(): looping: " + i + " world: " + world + " dim: " + ticket.world.provider.getDimensionId()); }
                else { System.out.println("playerTicketsLoaded(): looping: " + i + " world: " + world); }
                ++i;*/

                NBTTagCompound nbt = ticket.getModData();

                // Only claim tickets that are used for persistent chunk loading
                if (nbt != null && nbt.getBoolean("Persistent"))
                {
                    //System.out.println("playerTicketsLoaded(): found persistent ticket");
                    persistentPlayerTickets.put(player, ticket);
                }
            }
        }
    }

    claimedTickets.putAll(persistentPlayerTickets);

    return claimedTickets;
}