本文整理汇总了Java中java.util.HashMap.values方法的典型用法代码示例。如果您正苦于以下问题:Java HashMap.values方法的具体用法?Java HashMap.values怎么用?Java HashMap.values使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类java.util.HashMap
的用法示例。
在下文中一共展示了HashMap.values方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: appendJoins
import java.util.HashMap; //导入方法依赖的package包/类
private static void appendJoins(StringBuilder statement, HashMap<String, AssociationPath> explicitJoinsMap) {
ArrayList<AssociationPath> joins = new ArrayList<AssociationPath>(explicitJoinsMap.values());
Collections.sort(joins, new JoinComparator());
Iterator<AssociationPath> it = joins.iterator();
while (it.hasNext()) {
AssociationPath join = it.next();
StringBuilder joinSb = new StringBuilder(" left join ");
joinSb.append(join.getAliasedPathString());
joinSb.append(" as ");
joinSb.append(join.getJoinAlias());
statement.append(joinSb);
}
}
示例2: fetchPositionListIndexesStatic
import java.util.HashMap; //导入方法依赖的package包/类
protected static List<PositionListIndex> fetchPositionListIndexesStatic(List<HashMap<String, IntArrayList>> clusterMaps, boolean isNullEqualNull) {
List<PositionListIndex> clustersPerAttribute = new ArrayList<>();
for (int columnId = 0; columnId < clusterMaps.size(); columnId++) {
List<IntArrayList> clusters = new ArrayList<>();
HashMap<String, IntArrayList> clusterMap = clusterMaps.get(columnId);
if (!isNullEqualNull)
clusterMap.remove(null);
for (IntArrayList cluster : clusterMap.values())
if (cluster.size() > 1)
clusters.add(cluster);
clustersPerAttribute.add(new PositionListIndex(columnId, clusters));
}
return clustersPerAttribute;
}
示例3: setDirectionsOfNetworkComponent
import java.util.HashMap; //导入方法依赖的package包/类
/**
* Sets the directions of the specified NetworkComponent.
* @param networkComponent the NetworkComponent
*/
public void setDirectionsOfNetworkComponent(NetworkComponent networkComponent) {
HashMap<String, GraphEdgeDirection> edgeHash = networkComponent.getEdgeDirections();
for (GraphEdgeDirection direction : edgeHash.values()) {
// --- Set direction in this NetworkModel -------------------------
this.setGraphEdgeDirection(direction);
// ----------------------------------------------------------------
// --- Set the direction also to the alternative NetworkModels ----
// ----------------------------------------------------------------
if (this.alternativeNetworkModel!=null && this.alternativeNetworkModel.size()>0) {
for (NetworkModel altNetModel : this.alternativeNetworkModel.values()) {
if (altNetModel.getNetworkComponent(networkComponent.getId())!=null) {
altNetModel.setGraphEdgeDirection(direction);
}
}
}
// ----------------------------------------------------------------
}
}
示例4: execute
import java.util.HashMap; //导入方法依赖的package包/类
@Override
public void execute(Member author, User authorUser, MessageChannel channel, Message message, String parameters, Map<String, CommandStructure> commandList) {
Guild guild = author.getGuild();
Long guildID = guild.getIdLong();
Long userID = author.getUser().getIdLong();
if (hasPermission(author)) {
HashMap<Integer, Item> storeList = itemDB.getStoreList();
EmbedBuilder embed = new EmbedBuilder();
embed.setTitle(localize(channel, "command.store.title"), null);
for (Item item : storeList.values()) {
embed.addField(localize(channel, "command.store.item", item.getLocalizedName(channel), item.getInvID()),
localize(channel, "command.store.item_description", item.getDescription(channel), item.getCost()), true);
}
channel.sendMessage(embed.build()).queue();
}
}
示例5: main
import java.util.HashMap; //导入方法依赖的package包/类
public static void main(String[] args) {
HashMap<Agencia, Cliente[]> hm = new HashMap<Agencia, Cliente[]>();
// adiciona chave - agencia e valor = array Cliente
hm.put(new Agencia("ag01"), new Cliente[] { new Cliente("Enricando Cardoso"), new Cliente("Inacio Estole"), new Cliente("Luiz Ladrum"), });
hm.put(new Agencia("ag02"), new Cliente[] { new Cliente("Henri Cando"), new Cliente("Stolin Lu La"), new Cliente("Lara Pio"), });
hm.put(new Agencia("ag03"), new Cliente[] { new Cliente("Sony Gando"), new Cliente("Leiro Pisto"), new Cliente("Waga Oubum Du"), });
// imprime a colecao
System.out.println(hm);
// pega as chaves
Set chaves = hm.keySet();
// imprime as chaves
System.out.println(chaves);
// pega os valores
Collection<Cliente[]> valores = hm.values();
// imprime os valores
for (Cliente[] cs : valores) {
for (Cliente c : cs) {
System.out.println(c);
}
}
}
示例6: SetCompanyTask
import java.util.HashMap; //导入方法依赖的package包/类
/**
* @param pCompany The company of the user. The map must contain a String value with key "company_id" containing to the Company ID and a String value with key "name" containing the Company name. Can contain only String, char, int, long, float or double values.
* @throws IllegalArgumentException is thrown if company map check fails
*/
private SetCompanyTask(@NonNull HashMap<String,Object> pCompany) throws IllegalArgumentException {
Collection<Object> attrs = pCompany.values();
for(Object attr : attrs) {
if( attr instanceof String ||
attr instanceof Integer ||
attr instanceof Byte ||
attr instanceof Long ||
attr instanceof Double ||
attr instanceof Float ||
attr instanceof Character ||
attr instanceof Boolean) {
continue;
}
_log("Company HashMap can contain only String, char, byte, int, long, float or double values");
throw new IllegalArgumentException("Company HashMap can contain only String, char, byte, int, long, float or double values");
}
if(! pCompany.containsKey("company_id") && ! pCompany.containsKey("name")) {
_log("Company HashMap must contain a String value with key \"company_id\" containing to the Company ID and a String value with key \"name\" containing the Company name");
throw new IllegalArgumentException(
"Company HashMap must contain a String value with key \"company_id\" containing to the Company ID and a String value with key \"name\" containing the Company name"
);
}
this.company = new JSONObject(pCompany);
}
示例7: getTotalReferenceDepth
import java.util.HashMap; //导入方法依赖的package包/类
public static int getTotalReferenceDepth(HashMap<String, ErrorModel> perLaneErrorModels) {
int n = 0;
for (ErrorModel e : perLaneErrorModels.values()) {
n += e.getReferenceDepth();
}
return n;
}
示例8: getCachedWordLists
import java.util.HashMap; //导入方法依赖的package包/类
/**
* Returns the list of cached files for a specific locale, one for each category.
*
* This will return exactly one file for each word list category that matches
* the passed locale. If several files match the locale for any given category,
* this returns the file with the closest match to the locale. For example, if
* the passed word list is en_US, and for a category we have an en and an en_US
* word list available, we'll return only the en_US one.
* Thus, the list will contain as many files as there are categories.
*
* @param locale the locale to find the dictionary files for, as a string.
* @param context the context on which to open the files upon.
* @return an array of binary dictionary files, which may be empty but may not be null.
*/
public static File[] getCachedWordLists(final String locale, final Context context) {
final File[] directoryList = DictionaryInfoUtils.getCachedDirectoryList(context);
if (null == directoryList) return EMPTY_FILE_ARRAY;
final HashMap<String, FileAndMatchLevel> cacheFiles = new HashMap<>();
for (File directory : directoryList) {
if (!directory.isDirectory()) continue;
final String dirLocale =
DictionaryInfoUtils.getWordListIdFromFileName(directory.getName());
final int matchLevel = LocaleUtils.getMatchLevel(dirLocale, locale);
if (LocaleUtils.isMatch(matchLevel)) {
final File[] wordLists = directory.listFiles();
if (null != wordLists) {
for (File wordList : wordLists) {
final String category =
DictionaryInfoUtils.getCategoryFromFileName(wordList.getName());
final FileAndMatchLevel currentBestMatch = cacheFiles.get(category);
if (null == currentBestMatch || currentBestMatch.mMatchLevel < matchLevel) {
cacheFiles.put(category, new FileAndMatchLevel(wordList, matchLevel));
}
}
}
}
}
if (cacheFiles.isEmpty()) return EMPTY_FILE_ARRAY;
final File[] result = new File[cacheFiles.size()];
int index = 0;
for (final FileAndMatchLevel entry : cacheFiles.values()) {
result[index++] = entry.mFile;
}
return result;
}
示例9: updateLspsByDto
import java.util.HashMap; //导入方法依赖的package包/类
private void updateLspsByDto() {
HashMap<MvoId, RsvpLspDto> deleteSet = new HashMap<MvoId, RsvpLspDto>();
if (this.pw != null) {
for (RsvpLspDto lsp : this.pw.getRsvpLsps()) {
deleteSet.put(DtoUtil.getMvoId(lsp), lsp);
}
}
RsvpLspDto lsp1_ = null;
if (lsp1 != null) {
lsp1_ = deleteSet.get(DtoUtil.getMvoId(lsp1));
}
if (lsp1_ != null) {
deleteSet.remove(DtoUtil.getMvoId(lsp1));
}
RsvpLspDto lsp2_ = null;
if (lsp2 != null) {
lsp2_ = deleteSet.get(DtoUtil.getMvoId(lsp2));
}
if (lsp2_ != null) {
deleteSet.remove(DtoUtil.getMvoId(lsp2));
}
for (RsvpLspDto deleteLsp : deleteSet.values()) {
InventoryBuilder.translate(cmd, CMD.UNSTACK_LOWER_NETWORK,
CMD.ARG_LOWER, deleteLsp.getAbsoluteName());
}
if (lsp1_ == null && lsp1 != null) {
InventoryBuilder.translate(cmd, CMD.STACK_LOWER_NETWORK,
CMD.ARG_LOWER, lsp1.getAbsoluteName());
}
if (lsp2_ == null && lsp2 != null) {
InventoryBuilder.translate(cmd, CMD.STACK_LOWER_NETWORK,
CMD.ARG_LOWER, lsp2.getAbsoluteName());
}
}
示例10: openCamera
import java.util.HashMap; //导入方法依赖的package包/类
public void openCamera() {
Log.d(TAG, "openCamera");
mUiHandler.obtainMessage(WHAT_STATE, STATE_DISCOVERING, -1).sendToTarget();
HashMap<String, UsbDevice> deviceList = mUsbManager.getDeviceList();
Log.d(TAG, String.format("%d USB devices", deviceList.size()));
boolean found = false;
for (UsbDevice device : deviceList.values()) {
// TODO(tfmorse): deal with multiple picoflexx devices
if (isRoyaleDevice(device)) {
Log.d(TAG, "royale device found");
found = true;
if (!mUsbManager.hasPermission(device)) {
mUsbManager.requestPermission(device, mUsbPi);
} else {
performUsbPermissionCallback(device);
}
break;
}
}
if (!found) {
Log.e(TAG, "No royale device found.");
mUiHandler.obtainMessage(WHAT_STATE, STATE_NO_CAMERA, R.string.error_no_camera)
.sendToTarget();
}
}
示例11: run
import java.util.HashMap; //导入方法依赖的package包/类
public void run(Module m)
{
// Get types for type definition in Module.
HashMap<String, Type> st = m.getTypeSymbolTable();
for (Type ty : st.values())
incorperateType(ty);
// Get the type of GlobalVariable.
for (GlobalVariable gv : m.getGlobalVariableList())
{
incorperateType(gv.getType());
if (gv.hasInitializer())
incorperateValue(gv.getInitializer());
}
// Get types from functions.
for (Function f : m.getFunctionList())
{
for (BasicBlock bb : f.getBasicBlockList())
{
for (Instruction inst:bb)
{
incorperateType(inst.getType());
for (int i = 0, e = inst.getNumOfOperands(); i != e; i++)
{
incorperateValue(inst.operand(i));
}
}
}
}
}
示例12: createCluster
import java.util.HashMap; //导入方法依赖的package包/类
private Cluster createCluster(int numNodes) {
HashMap<Integer, Node> nodes = new HashMap<>();
for (int i = 0; i != numNodes; ++i) {
nodes.put(i, new Node(i, "localhost", 8121 + i));
}
Cluster cluster = new Cluster("mockClusterId", nodes.values(),
Collections.<PartitionInfo>emptySet(), Collections.<String>emptySet(),
Collections.<String>emptySet(), nodes.get(0));
return cluster;
}
示例13: assertParallelFilesAreIdentical
import java.util.HashMap; //导入方法依赖的package包/类
/**
* Given a list of directories, assert that any files that are named
* the same thing have the same contents. For example, if a file
* named "fsimage_1" shows up in more than one directory, then it must
* be the same.
* @throws Exception
*/
public static void assertParallelFilesAreIdentical(List<File> dirs,
Set<String> ignoredFileNames) throws Exception {
HashMap<String, List<File>> groupedByName = new HashMap<String, List<File>>();
for (File dir : dirs) {
for (File f : dir.listFiles()) {
if (ignoredFileNames.contains(f.getName())) {
continue;
}
List<File> fileList = groupedByName.get(f.getName());
if (fileList == null) {
fileList = new ArrayList<File>();
groupedByName.put(f.getName(), fileList);
}
fileList.add(f);
}
}
for (List<File> sameNameList : groupedByName.values()) {
if (sameNameList.get(0).isDirectory()) {
// recurse
assertParallelFilesAreIdentical(sameNameList, ignoredFileNames);
} else {
if ("VERSION".equals(sameNameList.get(0).getName())) {
assertPropertiesFilesSame(sameNameList.toArray(new File[0]));
} else {
assertFileContentsSame(sameNameList.toArray(new File[0]));
}
}
}
}
示例14: run
import java.util.HashMap; //导入方法依赖的package包/类
@Override
public void run() {
Main.getServerStateUpdaterTask().interrupt();
Main.getServerCommandSchedulerTask().interrupt();
Main.getServerFileCommunicatorTask().close();
if (Main.getMonitorTask() != null) {
Main.getMonitorTask().interrupt();
}
//End all server threads
HashMap<String, Server> serverList = Storage.getServerList();
synchronized (serverList) {
for (Server s : serverList.values()) {
s.endCurrentThread();
s.endBackupThread();
}
}
try {
Main.getServerCommandSchedulerTask().join();
Main.getServerStateUpdaterTask().join();
Main.getServerFileCommunicatorTask().join();
if (Main.getMonitorTask() != null) {
Main.getMonitorTask().join();
}
} catch (InterruptedException e) {
Printer.printError("ShutdownTask", "Shutting down task has been interrupted", e);
}
Printer.printBackgroundInfo("ShutdownTask", "The program has shutdown.");
Printer.close();
}
示例15: remove__A
import java.util.HashMap; //导入方法依赖的package包/类
public void remove__A()
{
for(HashMap<Integer, ArmorStand> car : cars.values())
{
for(ArmorStand as : car.values())
{
as.remove();
}
}
}