本文整理匯總了Java中com.google.common.collect.ArrayListMultimap類的典型用法代碼示例。如果您正苦於以下問題:Java ArrayListMultimap類的具體用法?Java ArrayListMultimap怎麽用?Java ArrayListMultimap使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
ArrayListMultimap類屬於com.google.common.collect包,在下文中一共展示了ArrayListMultimap類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: addDependencyForRelocation
import com.google.common.collect.ArrayListMultimap; //導入依賴的package包/類
public void addDependencyForRelocation(ModuleVersionSelector selector) {
// Some POMs depend on themselves through their parent POM, don't add this dependency
// since Ivy doesn't allow this!
// Example: http://repo2.maven.org/maven2/com/atomikos/atomikos-util/3.6.4/atomikos-util-3.6.4.pom
if (selector.getGroup().equals(descriptor.getComponentIdentifier().getGroup())
&& selector.getName().equals(descriptor.getComponentIdentifier().getModule())) {
return;
}
// TODO - this is a constant
ListMultimap<String, String> confMappings = ArrayListMultimap.create();
// Map dependency on all public configurations
for (Configuration m2Conf : GradlePomModuleDescriptorBuilder.MAVEN2_CONFIGURATIONS.values()) {
if (m2Conf.isVisible()) {
confMappings.put(m2Conf.getName(), m2Conf.getName());
}
}
dependencies.add(new IvyDependencyMetadata(selector, confMappings));
}
示例2: buildRecursively
import com.google.common.collect.ArrayListMultimap; //導入依賴的package包/類
private List<ConsumerProvidedTaskSelector> buildRecursively(GradleProject project) {
Multimap<String, String> aggregatedTasks = ArrayListMultimap.create();
collectTasks(project, aggregatedTasks);
List<ConsumerProvidedTaskSelector> selectors = Lists.newArrayList();
for (String selectorName : aggregatedTasks.keySet()) {
SortedSet<String> selectorTasks = Sets.newTreeSet(new TaskNameComparator());
selectorTasks.addAll(aggregatedTasks.get(selectorName));
selectors.add(new ConsumerProvidedTaskSelector().
setName(selectorName).
setTaskNames(selectorTasks).
setDescription(project.getParent() != null
? String.format("%s:%s task selector", project.getPath(), selectorName)
: String.format("%s task selector", selectorName)).
setDisplayName(String.format("%s in %s and subprojects.", selectorName, project.getName())));
}
return selectors;
}
示例3: groupTasksByType
import com.google.common.collect.ArrayListMultimap; //導入依賴的package包/類
private ListMultimap<Class, Task> groupTasksByType(List<Task> tasks) {
final Set<Class> taskTypes = new TreeSet<Class>(new Comparator<Class>() {
public int compare(Class o1, Class o2) {
return o1.getSimpleName().compareTo(o2.getSimpleName());
}
});
taskTypes.addAll(collect(tasks, new Transformer<Class, Task>() {
public Class transform(Task original) {
return getDeclaredTaskType(original);
}
}));
ListMultimap<Class, Task> tasksGroupedByType = ArrayListMultimap.create();
for (final Class taskType : taskTypes) {
tasksGroupedByType.putAll(taskType, filter(tasks, new Spec<Task>() {
public boolean isSatisfiedBy(Task element) {
return getDeclaredTaskType(element).equals(taskType);
}
}));
}
return tasksGroupedByType;
}
示例4: parsePermissions
import com.google.common.collect.ArrayListMultimap; //導入依賴的package包/類
private static ListMultimap<String, TablePermission> parsePermissions(
byte[] entryName, Result result) {
ListMultimap<String, TablePermission> perms = ArrayListMultimap.create();
if (result != null && result.size() > 0) {
for (Cell kv : result.rawCells()) {
Pair<String,TablePermission> permissionsOfUserOnTable =
parsePermissionRecord(entryName, kv);
if (permissionsOfUserOnTable != null) {
String username = permissionsOfUserOnTable.getFirst();
TablePermission permissions = permissionsOfUserOnTable.getSecond();
perms.put(username, permissions);
}
}
}
return perms;
}
示例5: addInstanceHandleToMap
import com.google.common.collect.ArrayListMultimap; //導入依賴的package包/類
/**
* Adds a instance handle to the mapping, triggers creation of sessions and routes if needed.
*
* @param instanceHandle instance handle for identification
* @param session session
* @param topicRoute topic route
*/
private void addInstanceHandleToMap(
final InstanceHandle_t instanceHandle,
final Session session,
final TopicRoute topicRoute
) {
// create topic session if first item discovered
if (!mapping.containsKey(session)) {
mapping.put(session, ArrayListMultimap.create());
mappingReverse.put(instanceHandle, session);
createSession(session);
}
// check if topic route is about to be created
if (!mapping.get(session).containsKey(topicRoute)) {
createTopicRoute(session, topicRoute);
}
// add instance handle to topic route
if (!mapping.get(session).get(topicRoute).contains(instanceHandle)) {
mapping.get(session).put(topicRoute, instanceHandle);
}
}
示例6: playerTicketsLoaded
import com.google.common.collect.ArrayListMultimap; //導入依賴的package包/類
@Override
public ListMultimap<String, ForgeChunkManager.Ticket> playerTicketsLoaded(ListMultimap<String, ForgeChunkManager.Ticket> tickets, World world)
{
// We don't care what order the tickets are in, but filter out the invalid ones
ListMultimap<String, ForgeChunkManager.Ticket> validTickets = ArrayListMultimap.create();
for (String playerName : tickets.keySet())
{
List<ForgeChunkManager.Ticket> playerTickets = new ArrayList<>();
for (ForgeChunkManager.Ticket tkt : tickets.get(playerName))
{
BlockPos ticketPosition = NBTUtil.getPosFromTag(tkt.getModData().getCompoundTag("position"));
TileEntity te = world.getTileEntity(ticketPosition);
if (te instanceof TileEntityChunkLoader)
{
playerTickets.add(tkt);
}
}
validTickets.putAll(playerName, playerTickets);
}
return validTickets;
}
示例7: createHostFragmentsMap
import com.google.common.collect.ArrayListMultimap; //導入依賴的package包/類
private Map<String,HostFragments> createHostFragmentsMap(List<NodeEndpoint> incomingEndpoints) {
Multimap<String,Integer> endpointMap = ArrayListMultimap.create();
for (int i = 0; i < incomingEndpoints.size(); i++) {
String host = incomingEndpoints.get(i).getAddress();
endpointMap.put(host, i);
}
List<HostFragments> hostFragments = new ArrayList<>();
for (Entry<String,Collection<Integer>> entry : endpointMap.asMap().entrySet()) {
hostFragments.add(new HostFragments(entry.getKey(), entry.getValue()));
}
return FluentIterable.from(hostFragments)
.uniqueIndex(new Function<HostFragments, String>() {
@Override
public String apply(HostFragments hostFragment) {
return hostFragment.host;
}
});
}
示例8: getRenderableContents
import com.google.common.collect.ArrayListMultimap; //導入依賴的package包/類
@Override
protected SectionRenderable getRenderableContents(RenderContext context)
{
Model model = getModel(context);
List<TaskModerator> moderatorList = workflowService.getModeratorList(model.getTaskId(), true);
Multimap<Boolean, ModRow> rows = ArrayListMultimap.create();
for( TaskModerator taskModerator : moderatorList )
{
HtmlLinkState link = createLinkForModerator(context, taskModerator);
if( link != null )
{
rows.put(taskModerator.isAccepted(), new ModRow(link, false));
}
}
model.setModerators(rows.get(false));
model.setModeratorsAccepted(rows.get(true));
return viewFactory.createResult("moddialog.ftl", this);
}
示例9: getTargetListPrivReindexingMap
import com.google.common.collect.ArrayListMultimap; //導入依賴的package包/類
private Multimap<String, TargetListEntry> getTargetListPrivReindexingMap(Set<String> reindexPrivs, TargetList tl)
{
Multimap<String, TargetListEntry> rv = ArrayListMultimap.create();
if( tl.getEntries() != null )
{
for( TargetListEntry entry : tl.getEntries() )
{
final String priv = entry.getPrivilege();
if( reindexPrivs.contains(priv) )
{
rv.get(priv).add(entry);
}
}
}
return rv;
}
示例10: getAttachmentsForItems
import com.google.common.collect.ArrayListMultimap; //導入依賴的package包/類
@Override
@Transactional(propagation = Propagation.MANDATORY)
public ListMultimap<Item, Attachment> getAttachmentsForItems(Collection<Item> items)
{
if( items.isEmpty() )
{
return ImmutableListMultimap.of();
}
List<Attachment> attachments = getHibernateTemplate().findByNamedParam(
"select a from Item i join i.attachments a where i in (:items) order by index(a) ASC", "items", items);
ListMultimap<Item, Attachment> multiMap = ArrayListMultimap.create();
for( Attachment attachment : attachments )
{
multiMap.put(attachment.getItem(), attachment);
}
return multiMap;
}
示例11: getAttachmentsForItemIds
import com.google.common.collect.ArrayListMultimap; //導入依賴的package包/類
@Override
@Transactional(propagation = Propagation.MANDATORY)
public ListMultimap<Long, Attachment> getAttachmentsForItemIds(Collection<Long> ids)
{
if( ids.isEmpty() )
{
return ImmutableListMultimap.of();
}
List<Object[]> attachments = getHibernateTemplate().findByNamedParam(
"select a, i.id from Item i join i.attachments a where i.id in (:items) order by index(a) ASC", "items",
ids);
ListMultimap<Long, Attachment> multiMap = ArrayListMultimap.create();
for( Object[] attachmentRow : attachments )
{
multiMap.put((Long) attachmentRow[1], (Attachment) attachmentRow[0]);
}
return multiMap;
}
示例12: getHistoryForItemIds
import com.google.common.collect.ArrayListMultimap; //導入依賴的package包/類
@Override
@Transactional(propagation = Propagation.MANDATORY)
public ListMultimap<Long, HistoryEvent> getHistoryForItemIds(Collection<Long> ids)
{
if( ids.isEmpty() )
{
return ImmutableListMultimap.of();
}
List<Object[]> history = getHibernateTemplate().findByNamedParam(
"select h, i.id from Item i join i.history h where i.id in (:items) order by index(h)", "items", ids);
ListMultimap<Long, HistoryEvent> multiMap = ArrayListMultimap.create();
for( Object[] historyRow : history )
{
multiMap.put((Long) historyRow[1], (HistoryEvent) historyRow[0]);
}
return multiMap;
}
示例13: getNavigationNodesForItemIds
import com.google.common.collect.ArrayListMultimap; //導入依賴的package包/類
@Override
@Transactional(propagation = Propagation.MANDATORY)
public ListMultimap<Long, ItemNavigationNode> getNavigationNodesForItemIds(Collection<Long> ids)
{
if( ids.isEmpty() )
{
return ImmutableListMultimap.of();
}
List<Object[]> node = getHibernateTemplate().findByNamedParam(
"select n, i.id from ItemNavigationNode n join n.item i where i.id in (:items) order by n.index ASC",
"items", ids);
ListMultimap<Long, ItemNavigationNode> multiMap = ArrayListMultimap.create();
for( Object[] nodeRow : node )
{
multiMap.put((Long) nodeRow[1], (ItemNavigationNode) nodeRow[0]);
}
return multiMap;
}
示例14: getCollaboratorsForItemIds
import com.google.common.collect.ArrayListMultimap; //導入依賴的package包/類
@Override
@Transactional(propagation = Propagation.MANDATORY)
public Multimap<Long, String> getCollaboratorsForItemIds(Collection<Long> itemIds)
{
if( itemIds.isEmpty() )
{
return ImmutableMultimap.of();
}
List<Object[]> attachments = getHibernateTemplate().findByNamedParam(
"select c, i.id from Item i join i.collaborators c where i.id in (:items)", "items", itemIds);
ListMultimap<Long, String> multiMap = ArrayListMultimap.create();
for( Object[] attachmentRow : attachments )
{
multiMap.put((Long) attachmentRow[1], (String) attachmentRow[0]);
}
return multiMap;
}
示例15: getDrmAcceptancesForItemIds
import com.google.common.collect.ArrayListMultimap; //導入依賴的package包/類
@Override
public ListMultimap<Long, DrmAcceptance> getDrmAcceptancesForItemIds(Collection<Long> itemIds)
{
if( itemIds.isEmpty() )
{
return ImmutableListMultimap.of();
}
final List<Object[]> drmAcceptances = getHibernateTemplate().findByNamedParam(
"select d, item.id from DrmAcceptance d where item.id in (:items) order by d.date DESC", "items", itemIds);
final ListMultimap<Long, DrmAcceptance> multiMap = ArrayListMultimap.create();
for( Object[] asseptRow : drmAcceptances )
{
multiMap.put((Long) asseptRow[1], (DrmAcceptance) asseptRow[0]);
}
return multiMap;
}