当前位置: 首页>>代码示例>>Java>>正文


Java LinkedHashMap.values方法代码示例

本文整理汇总了Java中java.util.LinkedHashMap.values方法的典型用法代码示例。如果您正苦于以下问题:Java LinkedHashMap.values方法的具体用法?Java LinkedHashMap.values怎么用?Java LinkedHashMap.values使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在java.util.LinkedHashMap的用法示例。


在下文中一共展示了LinkedHashMap.values方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: main

import java.util.LinkedHashMap; //导入方法依赖的package包/类
public static void main(String[] args) {

    //create LinkedHashMap object
    LinkedHashMap lHashMap = new LinkedHashMap();

    //add key value pairs to LinkedHashMap
    lHashMap.put("1", "One");
    lHashMap.put("2", "Two");
    lHashMap.put("3", "Three");

    /*
      get Collection of values contained in LinkedHashMap using
      Collection values() method of LinkedHashMap class
    */
    Collection c = lHashMap.values();

    //obtain an Iterator for Collection
    Iterator itr = c.iterator();

    //iterate through LinkedHashMap values iterator
    while (itr.hasNext()) System.out.println(itr.next());
  }
 
开发者ID:tranleduy2000,项目名称:javaide,代码行数:23,代码来源:IterateValuesOfLinkedHashMapExample.java

示例2: writeGroupedEntryMap

import java.util.LinkedHashMap; //导入方法依赖的package包/类
protected static <T extends GroupedBiomeEntry> void writeGroupedEntryMap(JsonObject o, LinkedHashMap<String, T> list) {
    for (T biome : list.values()) {
        String catname = biome.category.toString();
        if (!o.has(catname)) {
            o.add(catname, new JsonObject());
        }
        JsonObject catobject = JsonUtil.getAsObject(o, catname);

        if (!catobject.has(biome.group)) {
            catobject.add(biome.group, new JsonArray());
        }
        JsonArray groupobject = JsonUtil.getAsArray(catobject, biome.group);

        groupobject.add(biome.toJson());
    }
}
 
开发者ID:stuebz88,项目名称:modName,代码行数:17,代码来源:BiomeSettings.java

示例3: merge

import java.util.LinkedHashMap; //导入方法依赖的package包/类
static List<Map<String, String>> merge(List<List<Map<String, String>>> parts) {
  final LinkedHashMap<String, Map<String, String>> merged = new LinkedHashMap<>();
  for (List<Map<String, String>> part : parts) {
    for (Map<String, String> thisEntry : part) {
      merged.putIfAbsent(thisEntry.get(P_PACKAGE), thisEntry);
    }
  }
  return new ArrayList<>(merged.values());
}
 
开发者ID:sonatype-nexus-community,项目名称:nexus-repository-r,代码行数:10,代码来源:RPackagesUtils.java

示例4: setSchedules

import java.util.LinkedHashMap; //导入方法依赖的package包/类
/**
 * Set the schedules to be displayed in the reorder list.
 *
 * @param schedules SchedulesUtil
 */
public void setSchedules(LinkedHashMap<String, Schedule> schedules) {
    this.schedules = new ArrayList<>(schedules.size());
    this.schedulesDelete = new HashMap<>(schedules.size());

    long i = 0;

    for (Schedule schedule : schedules.values()) {
        this.schedules.add(new Pair<>(i++, schedule));
    }
}
 
开发者ID:linklux,项目名称:android-schedules,代码行数:16,代码来源:ManageDialogFragment.java

示例5: sortHashMapByValues

import java.util.LinkedHashMap; //导入方法依赖的package包/类
/**
 * Sorts LinkedHashMap by its values(natural descending order). keeps the
 * duplicates as it is.
 *
 * @param passedMap
 *          An Object of type LinkedHashMap to be sorted by its values.
 * @return An Object containing the sorted LinkedHashMap.
 */
private LinkedHashMap<?,?> sortHashMapByValues(LinkedHashMap<String,String> passedMap) {
  List<String> mapKeys = new ArrayList<String>(passedMap.keySet());
  List<String> mapValues = new ArrayList<String>(passedMap.values());

  Collections.sort(mapValues, new ValueComparator());
  Collections.sort(mapKeys);
  // Reversing the collection to sort the values in descending order
  Collections.reverse(mapValues);
  LinkedHashMap<String,String> sortedMap = new LinkedHashMap<String,String>();

  Iterator<String> valueIt = mapValues.iterator();
  while (valueIt.hasNext()) {
    String val = valueIt.next();
    Iterator<String> keyIt = mapKeys.iterator();
    while (keyIt.hasNext()) {
      String key = keyIt.next();
      String comp1 = passedMap.get(key).toString();
      String comp2 = val.toString();

      if (comp1.equals(comp2)) {
        passedMap.remove(key);
        mapKeys.remove(key);
        sortedMap.put(key, val);
        break;
      }
    }
  }
  return sortedMap;
}
 
开发者ID:GateNLP,项目名称:gate-core,代码行数:38,代码来源:DocTimeReporter.java

示例6: sortHashMapByValues

import java.util.LinkedHashMap; //导入方法依赖的package包/类
/**
 * Sorts LinkedHashMap by its values(natural descending order). keeps the
 * duplicates as it is.
 *
 * @param passedMap
 *          An Object of type LinkedHashMap to be sorted by its values.
 *
 * @return An Object containing the sorted LinkedHashMap.
 */
private LinkedHashMap<String,String> sortHashMapByValues(LinkedHashMap<String,String> passedMap) {
    List<String> mapKeys = new ArrayList<String>(passedMap.keySet());
    List<String> mapValues = new ArrayList<String>(passedMap.values());

    Collections.sort(mapValues, new ValueComparator());
    Collections.sort(mapKeys);
    Collections.reverse(mapValues);
    LinkedHashMap<String,String> sortedMap = new LinkedHashMap<String,String>();

    Iterator<String> valueIt = mapValues.iterator();
    while (valueIt.hasNext()) {
      String val = valueIt.next();
      Iterator<String> keyIt = mapKeys.iterator();
      while (keyIt.hasNext()) {
        String key = keyIt.next();
        String comp1 = passedMap.get(key).toString();
        String comp2 = val.toString();

        if (comp1.equals(comp2)) {
          passedMap.remove(key);
          mapKeys.remove(key);
          sortedMap.put(key, val);
          break;
        }
      }
    }
    return sortedMap;
}
 
开发者ID:GateNLP,项目名称:gate-core,代码行数:38,代码来源:PRTimeReporter.java

示例7: recreateFolderHierarchy

import java.util.LinkedHashMap; //导入方法依赖的package包/类
private void recreateFolderHierarchy(LinkedHashMap<Long, Bookmark> idMap) {
    for (Bookmark bookmark : idMap.values()) {
        if (bookmark.mId == ROOT_FOLDER_ID) continue;

        // Look for invalid parent ids and self-cycles.
        if (!idMap.containsKey(bookmark.mParentId) || bookmark.mParentId == bookmark.mId) {
            bookmark.mParent = idMap.get(ROOT_FOLDER_ID);
            bookmark.mParent.mEntries.add(bookmark);
            continue;
        }

        bookmark.mParent = idMap.get(bookmark.mParentId);
        bookmark.mParent.mEntries.add(bookmark);
    }
}
 
开发者ID:rkshuai,项目名称:chromium-for-android-56-debug-video,代码行数:16,代码来源:PartnerBookmarksReader.java

示例8: writeJsonableMap

import java.util.LinkedHashMap; //导入方法依赖的package包/类
static <T extends IJsonMappable> void writeJsonableMap(JsonObject o, LinkedHashMap<String, T> list, String tagname) {
    if (!list.isEmpty()) {
        JsonArray g = new JsonArray();
        for (T def : list.values()) {
            g.add(def.toJson());
        }
        o.add(tagname, g);
    }
}
 
开发者ID:stuebz88,项目名称:modName,代码行数:10,代码来源:Settings.java

示例9: getDiagnostics

import java.util.LinkedHashMap; //导入方法依赖的package包/类
DiagList getDiagnostics() {
    if (diags == null) {
        LinkedHashMap<String, Diag> diagMap = new LinkedHashMap<>();
        for (Diagnostic<? extends JavaFileObject> in : diagnostics.getDiagnostics()) {
            Diag d = diag(in);
            String uniqueKey = d.getCode() + ":" + d.getPosition() + ":" + d.getMessage(PARSED_LOCALE);
            diagMap.put(uniqueKey, d);
        }
        diags = new DiagList(diagMap.values());
    }
    return diags;
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:13,代码来源:TaskFactory.java

示例10: getMenuItems

import java.util.LinkedHashMap; //导入方法依赖的package包/类
public static List<MenuItem> getMenuItems(ArrayList<RecentEntityMenuBase> menus) {
	LinkedHashMap<String, MenuItem> menuItems = new LinkedHashMap<String, MenuItem>();
	if (menus != null && menus.size() > 0) {
		Iterator<RecentEntityMenuBase> it = menus.iterator();
		while (it.hasNext()) {
			findMenuItems(it.next().createMenuModel(WebUtil.getSessionScopeBean(), 0).getContents(), menuItems);
		}
	}
	return new ArrayList<MenuItem>(menuItems.values());
}
 
开发者ID:phoenixctms,项目名称:ctsms,代码行数:11,代码来源:RecentEntityMenuBase.java

示例11: getNamedParameters

import java.util.LinkedHashMap; //导入方法依赖的package包/类
public LinkedHashSet<NamedParameter> getNamedParameters(String resource, boolean excludeOverriden) throws Exception {
	LinkedHashMap<String, NamedParameter> namedParameters = new LinkedHashMap<String, NamedParameter>();
	Method method = getAnnotatedMethod(resource);
	if (method != null) {
		MethodParameterNames annotation = method.getAnnotation(MethodParameterNames.class);
		String[] parameterNames = null;
		if (annotation != null) {
			parameterNames = annotation.value();
		}
		Class[] parameterTypes = method.getParameterTypes();
		if (parameterNames != null && parameterTypes != null) {
			for (int i = 0; i < parameterNames.length; i++) {
				namedParameters.put(parameterNames[i], new NamedParameter(parameterNames[i], parameterTypes[i]));
			}
		}
	}
	Iterator<Entry<String, Object>> it = defaults.entrySet().iterator();
	while (it.hasNext()) {
		Entry<String, Object> defaultParameter = it.next();
		if (!namedParameters.containsKey(defaultParameter.getKey())) {
			namedParameters.put(defaultParameter.getKey(), new NamedParameter(defaultParameter.getKey(), defaultParameter.getValue().getClass()));
		}
	}
	it = overrides.entrySet().iterator();
	while (it.hasNext()) {
		Entry<String, Object> overrideParameter = it.next();
		namedParameters.put(overrideParameter.getKey(), new NamedParameter(overrideParameter.getKey(), overrideParameter.getValue().getClass()));
	}
	if (excludeOverriden) {
		it = overrides.entrySet().iterator();
		while (it.hasNext()) {
			namedParameters.remove(it.next().getKey());
		}
	}
	return new LinkedHashSet<NamedParameter>(namedParameters.values());
}
 
开发者ID:phoenixctms,项目名称:ctsms,代码行数:37,代码来源:ArgsUriPart.java

示例12: getMessages

import java.util.LinkedHashMap; //导入方法依赖的package包/类
protected MatrixCursor getMessages(String[] projection) throws InterruptedException {
    BlockingQueue<List<MessageInfoHolder>> queue = new SynchronousQueue<List<MessageInfoHolder>>();

    // new code for integrated inbox, only execute this once as it will be processed afterwards via the listener
    SearchAccount integratedInboxAccount = SearchAccount.createUnifiedInboxAccount(getContext());
    MessagingController msgController = MessagingController.getInstance(getContext());

    msgController.searchLocalMessages(integratedInboxAccount.getRelatedSearch(),
            new MessageInfoHolderRetrieverListener(queue));

    List<MessageInfoHolder> holders = queue.take();

    // TODO add sort order parameter
    Collections.sort(holders, new ReverseDateComparator());

    String[] projectionToUse;
    if (projection == null) {
        projectionToUse = DEFAULT_MESSAGE_PROJECTION;
    } else {
        projectionToUse = projection;
    }

    LinkedHashMap<String, FieldExtractor<MessageInfoHolder, ?>> extractors =
            resolveMessageExtractors(projectionToUse, holders.size());
    int fieldCount = extractors.size();

    String[] actualProjection = extractors.keySet().toArray(new String[fieldCount]);
    MatrixCursor cursor = new MatrixCursor(actualProjection);

    for (MessageInfoHolder holder : holders) {
        Object[] o = new Object[fieldCount];

        int i = 0;
        for (FieldExtractor<MessageInfoHolder, ?> extractor : extractors.values()) {
            o[i] = extractor.getField(holder);
            i += 1;
        }

        cursor.addRow(o);
    }

    return cursor;
}
 
开发者ID:philipwhiuk,项目名称:q-mail,代码行数:44,代码来源:MessageProvider.java

示例13: fix

import java.util.LinkedHashMap; //导入方法依赖的package包/类
private void fix() {
    /*
     * Useful references:
     * http://tools.ietf.org/html/rfc4121#page-5
     * http://tools.ietf.org/html/rfc2743#page-81
     * https://msdn.microsoft.com/en-us/library/ms995330.aspx
     */

    // Scan until we find the mech types list. If we find anything
    // unexpected, abort the fix process.
    if (!tag(0x60)) return;
    if (!length()) return;
    if (!oid("1.3.6.1.5.5.2")) return;
    if (!tag(0xa0)) return;
    if (!length()) return;
    if (!tag(0x30)) return;
    if (!length()) return;
    if (!tag(0xa0)) return;
    lengthAsInt();
    if (!tag(0x30)) return;
    // Now at the start of the mechType list.
    // Read the mechTypes into an ordered set
    int mechTypesLen = lengthAsInt();
    int mechTypesStart = pos;
    LinkedHashMap<String, int[]> mechTypeEntries = new LinkedHashMap<String, int[]>();
    while (pos < mechTypesStart + mechTypesLen) {
        int[] value = new int[2];
        value[0] = pos;
        String key = oidAsString();
        value[1] = pos - value[0];
        mechTypeEntries.put(key, value);
    }
    // Now construct the re-ordered mechType list
    byte[] replacement = new byte[mechTypesLen];
    int replacementPos = 0;

    int[] first = mechTypeEntries.remove("1.2.840.113554.1.2.2");
    if (first != null) {
        System.arraycopy(token, first[0], replacement, replacementPos, first[1]);
        replacementPos += first[1];
    }
    for (int[] markers : mechTypeEntries.values()) {
        System.arraycopy(token, markers[0], replacement, replacementPos, markers[1]);
        replacementPos += markers[1];
    }

    // Finally, replace the original mechType list with the re-ordered
    // one.
    System.arraycopy(replacement, 0, token, mechTypesStart, mechTypesLen);
}
 
开发者ID:liaokailin,项目名称:tomcat7,代码行数:51,代码来源:SpnegoAuthenticator.java

示例14: fix

import java.util.LinkedHashMap; //导入方法依赖的package包/类
private void fix() {
	/*
	 * Useful references: http://tools.ietf.org/html/rfc4121#page-5
	 * http://tools.ietf.org/html/rfc2743#page-81
	 * https://msdn.microsoft.com/en-us/library/ms995330.aspx
	 */

	// Scan until we find the mech types list. If we find anything
	// unexpected, abort the fix process.
	if (!tag(0x60))
		return;
	if (!length())
		return;
	if (!oid("1.3.6.1.5.5.2"))
		return;
	if (!tag(0xa0))
		return;
	if (!length())
		return;
	if (!tag(0x30))
		return;
	if (!length())
		return;
	if (!tag(0xa0))
		return;
	lengthAsInt();
	if (!tag(0x30))
		return;
	// Now at the start of the mechType list.
	// Read the mechTypes into an ordered set
	int mechTypesLen = lengthAsInt();
	int mechTypesStart = pos;
	LinkedHashMap<String, int[]> mechTypeEntries = new LinkedHashMap<String, int[]>();
	while (pos < mechTypesStart + mechTypesLen) {
		int[] value = new int[2];
		value[0] = pos;
		String key = oidAsString();
		value[1] = pos - value[0];
		mechTypeEntries.put(key, value);
	}
	// Now construct the re-ordered mechType list
	byte[] replacement = new byte[mechTypesLen];
	int replacementPos = 0;

	int[] first = mechTypeEntries.remove("1.2.840.113554.1.2.2");
	if (first != null) {
		System.arraycopy(token, first[0], replacement, replacementPos, first[1]);
		replacementPos += first[1];
	}
	for (int[] markers : mechTypeEntries.values()) {
		System.arraycopy(token, markers[0], replacement, replacementPos, markers[1]);
		replacementPos += markers[1];
	}

	// Finally, replace the original mechType list with the re-ordered
	// one.
	System.arraycopy(replacement, 0, token, mechTypesStart, mechTypesLen);
}
 
开发者ID:how2j,项目名称:lazycat,代码行数:59,代码来源:SpnegoAuthenticator.java

示例15: MapAdapter

import java.util.LinkedHashMap; //导入方法依赖的package包/类
public MapAdapter(@NonNull Context context, @LayoutRes int resource, @NonNull LinkedHashMap<K,V> map) {
    super(context, resource, new ArrayList<V>(map.values()));

    mMap = map;

    mKeys.addAll(mMap.keySet());
}
 
开发者ID:quaap,项目名称:LaunchTime,代码行数:8,代码来源:ChooseIconFromPackActivity.java


注:本文中的java.util.LinkedHashMap.values方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。