本文整理了Java中org.apache.commons.collections.MultiMap.keySet()
方法的一些代码示例,展示了MultiMap.keySet()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。MultiMap.keySet()
方法的具体详情如下:
包路径:org.apache.commons.collections.MultiMap
类名称:MultiMap
方法名:keySet
暂无
代码示例来源:origin: org.mule.modules/mule-module-http
@Override
public Collection<String> getHeaderNames()
{
return headers.keySet();
}
代码示例来源:origin: org.jsmiparser/jsmiparser-util
public Set<K> keySet() {
return m_impl.keySet();
}
代码示例来源:origin: jadler-mocking/jadler
/**
* @return all keys (lower-cased) from this instance (never returns {@code null})
*/
public Set<String> getKeys() {
@SuppressWarnings("unchecked")
final Set<String> result = new HashSet<String>(this.values.keySet());
return result;
}
代码示例来源:origin: net.jadler/jadler-core
/**
* @return all keys (lower-cased) from this instance (never returns {@code null})
*/
public Set<String> getKeys() {
@SuppressWarnings("unchecked")
final Set<String> result = new HashSet<String>(this.values.keySet());
return result;
}
代码示例来源:origin: com.atlassian.jira/jira-core
public Set<String> getWorkflowsInUse()
{
@SuppressWarnings ("unchecked")
final Set<WorkflowTransitionKey> workflowTransitionMapKeys = workflowTransitionMap.keySet();
return CollectionUtil.transformSet(workflowTransitionMapKeys, new Function<WorkflowTransitionKey, String>()
{
public String get(final WorkflowTransitionKey input)
{
return input.getWorkflowName();
}
});
}
代码示例来源:origin: com.atlassian.jira.plugin.labels/jira-labels-plugin
public Collection getKeys()
{
TreeSet keys = new TreeSet(new Comparator()
{
public int compare(Object o1, Object o2)
{
if (o1.equals(o2))
{
return 0;
}
if (NUMERIC.equals(o1))
{
return 1;
}
else if (NUMERIC.equals(o2))
{
return -1;
}
else
{
return collator.compare(o1, o2);
}
}
});
keys.addAll(alphabetBuckets.keySet());
return keys;
}
代码示例来源:origin: com.atlassian.jira/jira-tests
public Map toMap()
{
Map paramMap = new HashMap();
for (Object key : map.keySet())
{
List list = (List) map.get(key);
String[] vals = new String[list.size()];
for (int i = 0; i < vals.length; i++)
{
vals[i] = String.valueOf(list.get(i));
}
paramMap.put(key, vals);
}
return paramMap;
}
}
代码示例来源:origin: jadler-mocking/jadler
private KeyValues createHeaders() {
KeyValues res = new KeyValues();
for (@SuppressWarnings("unchecked") final Iterator<String> itKey =
(Iterator<String>) this.headers.keySet().iterator(); itKey.hasNext();) {
final String key = itKey.next();
for (@SuppressWarnings("unchecked") final Iterator<String> itValue =
((Collection<String>)this.headers.get(key)).iterator(); itValue.hasNext();) {
res = res.add(key, itValue.next());
}
}
return res;
}
}
代码示例来源:origin: net.jadler/jadler-core
private KeyValues createHeaders() {
KeyValues res = new KeyValues();
for (@SuppressWarnings("unchecked") final Iterator<String> itKey =
(Iterator<String>) this.headers.keySet().iterator(); itKey.hasNext();) {
final String key = itKey.next();
for (@SuppressWarnings("unchecked") final Iterator<String> itValue =
((Collection<String>)this.headers.get(key)).iterator(); itValue.hasNext();) {
res = res.add(key, itValue.next());
}
}
return res;
}
}
代码示例来源:origin: com.atlassian.jira/jira-core
public List<WorkflowTransitionKey> getTransitionIdsForWorkflow(final String workflowName)
{
@SuppressWarnings ("unchecked")
final Collection<WorkflowTransitionKey> workflowTransitionMaps = workflowTransitionMap.keySet();
final List<WorkflowTransitionKey> transitionIdsForWorkflow = Lists.newArrayListWithCapacity(workflowTransitionMaps.size());
for (final WorkflowTransitionKey wfTransitionKey : workflowTransitionMaps)
{
if (wfTransitionKey.getWorkflowName().equals(workflowName))
{
transitionIdsForWorkflow.add(wfTransitionKey);
}
}
//Sorting the list by actiondescriptor, to ensure that if there's two lines
//for an action descriptor they'll be grouped (see JRA-12017 about how this may happen).
Collections.sort(transitionIdsForWorkflow, new Comparator<WorkflowTransitionKey>()
{
public int compare(final WorkflowTransitionKey o1, final WorkflowTransitionKey o2)
{
return o1.getActionDescriptorId().compareTo(o2.getActionDescriptorId());
}
});
return transitionIdsForWorkflow;
}
代码示例来源:origin: com.atlassian.jira/jira-core
private ErrorCollection validateNoUsageOfRoleInWorkflows(final ProjectRole projectRole)
{
ErrorCollection errorCollection = new SimpleErrorCollection();
Set<JiraWorkflow> workflows = getAssociatedWorkflows(projectRole, errorCollection).keySet();
if(!workflows.isEmpty())
{
List<String> workflowNames = workflows.stream().map(JiraWorkflow::getDisplayName).collect(Collectors.toList());
String workflowListString = "[" + StringUtils.join(workflowNames, ",") + "]";
errorCollection.addErrorMessage(getText("rest.role.used.in.workflows", workflowListString), ErrorCollection.Reason.CONFLICT);
}
return errorCollection;
}
代码示例来源:origin: org.hibernate/hibernate-tools
/**
* Copies all the values from one MultiMap to another.
* This method is needed because the (undocumented) behaviour of
* MultiHashMap.putAll in versions of Commons Collections prior to 3.0
* was to replace the collection in the destination, whereas in 3.0
* it adds the collection from the source as an _element_ of the collection
* in the destination. This method makes no assumptions about the implementation
* of the MultiMap, and should work with all versions.
*
* @param destination
* @param specific
*/
public static void copyMultiMap(MultiMap destination, MultiMap specific) {
for (Iterator<?> keyIterator = specific.keySet().iterator(); keyIterator.hasNext(); ) {
Object key = keyIterator.next();
Collection<?> c = (Collection<?>)specific.get(key);
for (Iterator<?> valueIterator = c.iterator(); valueIterator.hasNext(); )
destination.put(key, valueIterator.next() );
}
}
代码示例来源:origin: hibernate/hibernate-tools
/**
* Copies all the values from one MultiMap to another.
* This method is needed because the (undocumented) behaviour of
* MultiHashMap.putAll in versions of Commons Collections prior to 3.0
* was to replace the collection in the destination, whereas in 3.0
* it adds the collection from the source as an _element_ of the collection
* in the destination. This method makes no assumptions about the implementation
* of the MultiMap, and should work with all versions.
*
* @param destination
* @param specific
*/
public static void copyMultiMap(MultiMap destination, MultiMap specific) {
for (Iterator<?> keyIterator = specific.keySet().iterator(); keyIterator.hasNext(); ) {
Object key = keyIterator.next();
Collection<?> c = (Collection<?>)specific.get(key);
for (Iterator<?> valueIterator = c.iterator(); valueIterator.hasNext(); )
destination.put(key, valueIterator.next() );
}
}
代码示例来源:origin: com.atlassian.jira/jira-api
public FieldConfig getOneAndOnlyConfig()
{
final MultiMap configsByConfig = getConfigsByConfig();
if ((configsByConfig != null) && (configsByConfig.size() == 1))
{
return (FieldConfig) configsByConfig.keySet().iterator().next();
}
else
{
if (configsByConfig != null)
{
log.warn("There is not exactly one config for this scheme (" + getId() + "). Configs are " + configsByConfig + ".");
}
return null;
}
}
代码示例来源:origin: com.atlassian.jira/jira-core
/**
* Retreives all the options for the {@link FieldConfigScheme}.
*
* @param fieldConfigScheme the config scheme to retrieve the options from.
* @return the options for the {@link FieldConfigScheme} in a mutable {@link java.util.List}; never null.
*/
public List<Option> getOptionsForScheme(final FieldConfigScheme fieldConfigScheme)
{
List<Option> optionList = new ArrayList<Option>();
final Set<FieldConfig> configSet = fieldConfigScheme.getConfigsByConfig().keySet();
for (FieldConfig fieldConfig : configSet)
{
final Options options = optionsManager.getOptions(fieldConfig);
if (options != null)
{
for (Object o : options)
{
final Option option = (Option) o;
optionList.add(option);
optionList.addAll(option.getChildOptions());
}
}
}
return optionList;
}
代码示例来源:origin: org.hibernate/hibernate-tools
for (Iterator<?> iter = general.keySet().iterator();iter.hasNext();) {
Object key = iter.next();
代码示例来源:origin: com.atlassian.jira/jira-core
private void swapRoleInWorkflows(final ProjectRole role, final ProjectRole swapRole)
{
ErrorCollection errorCollection = new SimpleErrorCollection();
MultiMap associatedWorkflows = getAssociatedWorkflows(role, errorCollection);
String moduleKey = "com.atlassian.jira.plugin.system.workflow:isuserinprojectrole-condition";
String className = "com.atlassian.jira.workflow.condition.InProjectRoleCondition";
for (Object o : associatedWorkflows.keySet())
{
if(!(associatedWorkflows.get(o) instanceof Collection))
{
throw new IllegalStateException("Associated workflows returned an unexpected map");
}
for (ActionDescriptor actionDescriptor: (Collection<ActionDescriptor>)associatedWorkflows.get(o))
{
JiraWorkflow jiraWorkflow = (JiraWorkflow) o;
//JiraWorkflow clone = workflowManager.getWorkflowClone(jiraWorkflow.getName());
workflowManager.replaceConditionInTransition(
actionDescriptor,
ImmutableMap.of("jira.projectrole.id", role.getId().toString(), "class.name", className),
ImmutableMap.of("jira.projectrole.id", swapRole.getId().toString()));
workflowManager.saveWorkflowWithoutAudit(jiraWorkflow);
}
}
}
代码示例来源:origin: qcadoo/mes
private Either<String, Void> createDocumentsForNotUsedMaterials(final Entity order) {
List<Entity> productionCountingQuantities = getUniqueProductionCountingQuantitiesForOrder(order);
MultiMap groupedProductionCountingQuantities = groupProductionCountingQuantitiesByField(productionCountingQuantities,
ProductionCountingQuantityFieldsPFTD.COMPONENTS_LOCATION);
for (Object inLocation : groupedProductionCountingQuantities.keySet()) {
if (inLocation != null) {
List<Entity> list = new ArrayList<Entity>();
list.addAll((Collection<Entity>) groupedProductionCountingQuantities.get(inLocation));
MultiMap groupedByOutputLocation = groupProductionCountingQuantitiesByField(list,
ProductionCountingQuantityFieldsPFTD.COMPONENTS_OUTPUT_LOCATION);
for (Object outLocation : groupedByOutputLocation.keySet()) {
if (outLocation != null) {
Either<String, Void> isValid = createTransferDocumentsForUnusedMaterials((Entity) outLocation,
(Entity) inLocation, getProductsAndQuantitiesMap(groupedByOutputLocation, order), order);
if (isValid.isLeft()) {
return isValid;
}
}
}
}
}
return Either.right(null);
}
代码示例来源:origin: net.jadler/jadler-core
/**
* Removes all occurrences of the given header in this stub response (using a case insensitive search)
* and sets its single value.
* @param name header name
* @param value header value
*/
@SuppressWarnings("unchecked")
void setHeaderCaseInsensitive(final String name, final String value) {
final MultiMap result = new MultiValueMap();
for (final Object o: this.headers.keySet()) {
final String key = (String) o; //fucking non-generics MultiMap
if (!name.equalsIgnoreCase(key)) {
//copy all other headers to the result multimap
for(final String s: (Collection<String>)this.headers.get(o)) {
result.put(o, s);
}
}
}
this.headers.clear();
this.headers.putAll(result);
this.addHeader(name, value);
}
代码示例来源:origin: jadler-mocking/jadler
/**
* Removes all occurrences of the given header in this stub response (using a case insensitive search)
* and sets its single value.
* @param name header name
* @param value header value
*/
@SuppressWarnings("unchecked")
void setHeaderCaseInsensitive(final String name, final String value) {
final MultiMap result = new MultiValueMap();
for (final Object o: this.headers.keySet()) {
final String key = (String) o; //fucking non-generics MultiMap
if (!name.equalsIgnoreCase(key)) {
//copy all other headers to the result multimap
for(final String s: (Collection<String>)this.headers.get(o)) {
result.put(o, s);
}
}
}
this.headers.clear();
this.headers.putAll(result);
this.addHeader(name, value);
}
内容来源于网络,如有侵权,请联系作者删除!