List of usage examples for java.util LinkedHashMap LinkedHashMap
public LinkedHashMap()
From source file:com.codeup.auth.application.authentication.LoginInput.java
public LoginInput() { messages = new LinkedHashMap<>(); values = new HashMap<>(); }
From source file:Main.java
public static Map<String, String> extractParameters(String exString) { exString = exString.trim();//from w ww . j av a 2 s. c om int leftParIndex = exString.indexOf(LEFT_PARENTHESIS); if (leftParIndex == -1) { return Collections.emptyMap(); } String paramsStr; if (exString.endsWith(")")) { paramsStr = exString.substring(leftParIndex + 1, exString.lastIndexOf(")")); } else { paramsStr = exString.substring(leftParIndex + 1, exString.length()); } Map<String, String> parameters = new LinkedHashMap<String, String>(); String[] paramsPairs = paramsStr.trim().split(","); for (String paramsPair : paramsPairs) { String[] keyValue = paramsPair.trim().split("="); if (keyValue.length == 2) { parameters.put(keyValue[0].trim(), keyValue[1].trim()); } } return parameters; }
From source file:com.linecorp.armeria.server.docs.Specification.java
static Specification forServiceConfigs(Iterable<ServiceConfig> serviceConfigs, Map<Class<?>, ? extends TBase<?, ?>> sampleRequests) { final Map<Class<?>, Iterable<EndpointInfo>> map = new LinkedHashMap<>(); for (ServiceConfig c : serviceConfigs) { c.service().as(ThriftService.class).ifPresent(service -> { for (Class<?> iface : service.interfaces()) { final Class<?> serviceClass = iface.getEnclosingClass(); final List<EndpointInfo> endpoints = (List<EndpointInfo>) map.computeIfAbsent(serviceClass, cls -> new ArrayList<>()); c.pathMapping().exactPath() .ifPresent(p -> endpoints.add(EndpointInfo.of(c.virtualHost().hostnamePattern(), p, service.defaultSerializationFormat(), service.allowedSerializationFormats()))); }/*from w ww. ja v a 2s. c om*/ }); } return forServiceClasses(map, sampleRequests); }
From source file:Main.java
public static <K, V> Map<K, V> mapOf(K key, V value, K key2, V value2, K key3, V value3, K key4, V value4) { Map<K, V> map = new LinkedHashMap<K, V>(); map.put(key, value);//from w ww .ja v a 2 s . c o m map.put(key2, value2); map.put(key3, value3); map.put(key4, value4); return map; }
From source file:Main.java
static Map<String, String> buildQueries(String baseQuery, List<Date> datesByQueryIndex) { Map<String, String> fqlByQueryIndex = new LinkedHashMap<String, String>(); for (int queryIndex = 0; queryIndex < datesByQueryIndex.size(); queryIndex++) { Date d = datesByQueryIndex.get(queryIndex); String query = baseQuery + convertToUnixTimeOneDayLater(d); fqlByQueryIndex.put(String.valueOf(queryIndex), query); }/*from w ww. ja va 2 s . c o m*/ return fqlByQueryIndex; }
From source file:Main.java
/** * Given a stream, and a function for creating default values, constructs a map from keys to elements of * type T built using the producer.//from w ww . j a v a2 s . c om * @param keyStream The stream of keys for the map * @param valuesSupplier The function that produces default values for the map * @param <T> The type of the keys of the map * @param <U> The type of the values of the map */ public static <T, U> LinkedHashMap<T, U> buildMap(Stream<T> keyStream, Supplier<U> valuesSupplier) { LinkedHashMap<T, U> map = new LinkedHashMap<>(); keyStream.forEach(key -> map.put(key, valuesSupplier.get())); return map; }
From source file:com.diffplug.gradle.ConfigMisc.java
/** Creates an XML string from a groovy.util.Node. */ public static Supplier<byte[]> props(Action<Map<String, String>> mapPopulate) { return () -> { Map<String, String> map = new LinkedHashMap<>(); mapPopulate.execute(map);//from w w w .j a v a2 s. c o m return props(map); }; }
From source file:com.github.horrorho.inflatabledonkey.args.OptionsFactory.java
public static Map<Option, Property> options() { LinkedHashMap<Option, Property> options = new LinkedHashMap<>(); options.put(Option.builder("d").longOpt("device").desc("Device, default: 0 = first device.").argName("int") .hasArg().build(), Property.SELECT_DEVICE_INDEX); options.put(Option.builder("s").longOpt("snapshot").desc("Snapshot, default: 0 = first snapshot.") .argName("int").hasArg().build(), Property.SELECT_SNAPSHOT_INDEX); options.put(Option.builder().longOpt("extension").desc("File extension filter, case insensitive.") .argName("string").hasArg().build(), Property.FILTER_EXTENSION); options.put(Option.builder().longOpt("domain").desc("Domain filter, case insensitive.").argName("string") .hasArg().build(), Property.FILTER_DOMAIN); options.put(Option.builder("o").longOpt("folder").desc("Output folder.").argName("string").hasArg().build(), Property.OUTPUT_FOLDER);/*from www . j a v a 2s. co m*/ options.put(new Option(null, "snapshots", false, "List device/ snapshot information and exit."), Property.PRINT_SNAPSHOTS); options.put( new Option(null, "domains", false, "List domains/ file count for the selected snapshot and exit."), Property.PRINT_DOMAIN_LIST); options.put(new Option(null, "token", false, "Display dsPrsID:mmeAuthToken and exit."), Property.ARGS_TOKEN); options.put(new Option(null, "help", false, "Display this help and exit."), Property.ARGS_HELP); return options; }
From source file:Main.java
/** * This method will find all the parameters under this <code>paramsElement</code> and return them as * Map<String, String>. For example, * <pre>//from w w w . j a v a2s .co m * <result ... > * <param name="param1">value1</param> * <param name="param2">value2</param> * <param name="param3">value3</param> * </result> * </pre> * will returns a Map<String, String> with the following key, value pairs :- * <ul> * <li>param1 - value1</li> * <li>param2 - value2</li> * <li>param3 - value3</li> * </ul> * * @param paramsElement * @return */ public static Map<String, String> getParams(Element paramsElement) { LinkedHashMap<String, String> params = new LinkedHashMap<String, String>(); if (paramsElement == null) { return params; } NodeList childNodes = paramsElement.getChildNodes(); for (int i = 0; i < childNodes.getLength(); i++) { Node childNode = childNodes.item(i); if ((childNode.getNodeType() == Node.ELEMENT_NODE) && "param".equals(childNode.getNodeName())) { Element paramElement = (Element) childNode; String paramName = paramElement.getAttribute("name"); String val = getContent(paramElement); if (val.length() > 0) { params.put(paramName, val); } } } return params; }
From source file:edu.northwestern.bioinformatics.studycalendar.dataproviders.commands.BusyBoxCommand.java
protected BusyBoxCommand() { subcommands = new LinkedHashMap<String, Subcommand>(); }