Java Code Examples for java.util.LinkedHashMap
The following examples show how to use
java.util.LinkedHashMap. These examples are extracted from open source projects.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source Project: pravega Source File: ReaderGroupState.java License: Apache License 2.0 | 6 votes |
ReaderGroupState(String scopedSynchronizerStream, Revision revision, ReaderGroupConfig config, Map<SegmentWithRange, Long> segmentsToOffsets, Map<Segment, Long> endSegments) { Exceptions.checkNotNullOrEmpty(scopedSynchronizerStream, "scopedSynchronizerStream"); Preconditions.checkNotNull(revision); Preconditions.checkNotNull(config); Exceptions.checkNotNullOrEmpty(segmentsToOffsets.entrySet(), "segmentsToOffsets"); this.scopedSynchronizerStream = scopedSynchronizerStream; this.config = config; this.revision = revision; this.checkpointState = new CheckpointState(); this.distanceToTail = new HashMap<>(); this.futureSegments = new HashMap<>(); this.assignedSegments = new HashMap<>(); this.unassignedSegments = new LinkedHashMap<>(segmentsToOffsets); this.lastReadPosition = new HashMap<>(segmentsToOffsets); this.endSegments = ImmutableMap.copyOf(endSegments); }
Example 2
Source Project: codebuff Source File: ClassPath.java License: BSD 2-Clause "Simplified" License | 6 votes |
@VisibleForTesting static ImmutableMap<File, ClassLoader> getClassPathEntries(ClassLoader classloader) { LinkedHashMap<File, ClassLoader> entries = Maps.newLinkedHashMap(); // Search parent first, since it's the order ClassLoader#loadClass() uses. ClassLoader parent = classloader.getParent(); if (parent != null) { entries.putAll(getClassPathEntries(parent)); } if (classloader instanceof URLClassLoader) { URLClassLoader urlClassLoader = (URLClassLoader) classloader; for (URL entry : urlClassLoader.getURLs()) { if (entry.getProtocol().equals("file")) { File file = new File(entry.getFile()); if (!entries.containsKey(file)) { entries.put(file, classloader); } } } } return ImmutableMap.copyOf(entries); }
Example 3
Source Project: qpid-broker-j Source File: ConnectionTune.java License: Apache License 2.0 | 6 votes |
@Override public Map<String,Object> getFields() { Map<String,Object> result = new LinkedHashMap<String,Object>(); if ((packing_flags & 256) != 0) { result.put("channelMax", getChannelMax()); } if ((packing_flags & 512) != 0) { result.put("maxFrameSize", getMaxFrameSize()); } if ((packing_flags & 1024) != 0) { result.put("heartbeatMin", getHeartbeatMin()); } if ((packing_flags & 2048) != 0) { result.put("heartbeatMax", getHeartbeatMax()); } return result; }
Example 4
Source Project: shardingsphere Source File: EncryptDatabasesConfiguration.java License: Apache License 2.0 | 6 votes |
@Override public DataSource getDataSource() { Properties props = new Properties(); props.setProperty("aes.key.value", "123456"); props.setProperty("query.with.cipher.column", "true"); EncryptColumnRuleConfiguration columnConfigAes = new EncryptColumnRuleConfiguration("user_name", "user_name", "", "user_name_plain", "name_encryptor"); EncryptColumnRuleConfiguration columnConfigTest = new EncryptColumnRuleConfiguration("pwd", "pwd", "assisted_query_pwd", "", "pwd_encryptor"); EncryptTableRuleConfiguration encryptTableRuleConfiguration = new EncryptTableRuleConfiguration("t_user", Arrays.asList(columnConfigAes, columnConfigTest)); Map<String, ShardingSphereAlgorithmConfiguration> encryptAlgorithmConfigurations = new LinkedHashMap<>(2, 1); encryptAlgorithmConfigurations.put("name_encryptor", new ShardingSphereAlgorithmConfiguration("AES", props)); encryptAlgorithmConfigurations.put("pwd_encryptor", new ShardingSphereAlgorithmConfiguration("assistedTest", props)); EncryptRuleConfiguration encryptRuleConfiguration = new EncryptRuleConfiguration(Collections.singleton(encryptTableRuleConfiguration), encryptAlgorithmConfigurations); try { return ShardingSphereDataSourceFactory.createDataSource(DataSourceUtil.createDataSource("demo_ds"), Collections.singleton(encryptRuleConfiguration), props); } catch (final SQLException ex) { ex.printStackTrace(); return null; } }
Example 5
Source Project: xbee-java Source File: IPv6RemoteATCommandRequestPacketTest.java License: Mozilla Public License 2.0 | 6 votes |
/** * Test method for {@link com.digi.xbee.api.packet.thread.IPv6RemoteATCommandRequestPacket#getAPIPacketParameters()}. * * <p>Test the get API parameters but with a parameter value.</p> */ @Test public final void testGetAPIPacketParametersATCommandParameterByteArrayNonStringCmd() { // Setup the resources for the test. String command = "DL"; byte[] parameter = new byte[]{0x6D, 0x79}; IPv6RemoteATCommandRequestPacket packet = new IPv6RemoteATCommandRequestPacket(frameID, ipv6address, transmitOptions, command, parameter); String expectedDestAddr = HexUtils.prettyHexString(ipv6address.getAddress()) + " (" + ipv6address.getHostAddress() + ")"; String expectedOptions = HexUtils.prettyHexString(HexUtils.integerToHexString(transmitOptions, 1)); String expectedATCommand = HexUtils.prettyHexString(command.getBytes()) + " (" + command + ")"; String expectedATParameter = HexUtils.prettyHexString(parameter); // Call the method under test. LinkedHashMap<String, String> packetParams = packet.getAPIPacketParameters(); // Verify the result. assertThat("Packet parameters map size is not the expected one", packetParams.size(), is(equalTo(4))); assertThat("Destination IPv6 Address is not the expected one", packetParams.get("Destination address"), is(equalTo(expectedDestAddr))); assertThat("Command options are not the expected one", packetParams.get("Command options"), is(equalTo(expectedOptions))); assertThat("AT Command is not the expected one", packetParams.get("AT Command"), is(equalTo(expectedATCommand))); assertThat("AT Parameter is not the expected one", packetParams.get("Parameter"), is(equalTo(expectedATParameter))); }
Example 6
Source Project: aptoide-client-v8 Source File: AptoideUtils.java License: GNU General Public License v3.0 | 6 votes |
public static Map<String, String> splitQuery(URI uri) throws UnsupportedEncodingException { Map<String, String> query_pairs = new LinkedHashMap<>(); String query = uri.getQuery(); if (query != null) { String[] pairs = query.split("&"); if (pairs != null) { for (String pair : pairs) { int idx = pair.indexOf("="); if (idx > 0 && idx + 1 < pair.length()) { query_pairs.put(URLDecoder.decode(pair.substring(0, idx), "UTF-8"), URLDecoder.decode(pair.substring(idx + 1), "UTF-8")); } } } } return query_pairs; }
Example 7
Source Project: carbon-kernel Source File: ConfigProviderOSGITest.java License: Apache License 2.0 | 6 votes |
@Test public void testConfigurationProvider() throws ConfigurationException { CarbonConfiguration carbonConfiguration = configProvider.getConfigurationObject( CarbonConfiguration.class); String id = carbonConfiguration.getId(); String name = carbonConfiguration.getName(); String tenant = carbonConfiguration.getTenant(); Assert.assertEquals(id, "carbon-kernel", "id should be carbon-kernel"); Assert.assertEquals(name, "WSO2 Carbon Kernel", "name should be WSO2 Carbon Kernel"); Assert.assertEquals(tenant, "default", "tenant should be default"); Map secureVaultConfiguration = (LinkedHashMap) configProvider.getConfigurationObject("wso2.securevault"); Assert.assertEquals(((LinkedHashMap) (secureVaultConfiguration.get("secretRepository"))).get("type"), "org.wso2.carbon.secvault.repository.DefaultSecretRepository", "Default secret repository would be " + "org.wso2.carbon.secvault.repository.DefaultSecretRepository"); Assert.assertEquals(((LinkedHashMap) (secureVaultConfiguration.get("masterKeyReader"))).get("type"), "org.wso2.carbon.secvault.reader.DefaultMasterKeyReader", "Default master key reader would be " + "org.wso2.carbon.secvault.reader.DefaultMasterKeyReader"); }
Example 8
Source Project: mPaaS Source File: QueryRequest.java License: Apache License 2.0 | 6 votes |
/** * 添加条件 */ @SuppressWarnings("unchecked") public QueryRequest addCondition(String column, Operator opt, Object value) { Map<Object, Object> map; if (this.conditions == null) { this.conditions = new LinkedHashMap<>(); map = new LinkedHashMap<>(16); this.conditions.put(column, map); } else { Object val = this.conditions.get(column); if (val == null) { map = new LinkedHashMap<>(); this.conditions.put(column, map); } else if (val instanceof Map) { map = (Map<Object, Object>) val; } else { map = new LinkedHashMap<>(16); this.conditions.put(column, map); map.put(Operator.eq, val); } } map.put(opt.getValue(), value); return this; }
Example 9
Source Project: rundeck-cli Source File: JobItem.java License: Apache License 2.0 | 6 votes |
public Map<Object, Object> toMap() { HashMap<Object, Object> map = new LinkedHashMap<>(); map.put("id", getId()); map.put("name", getName()); if (null != getGroup()) { map.put("group", getGroup()); } map.put("project", getProject()); map.put("href", getHref()); map.put("permalink", getPermalink()); map.put("description", getDescription()); if(null!=getAverageDuration()){ map.put("averageDuration", getAverageDuration()); } return map; }
Example 10
Source Project: Eclipse-Postfix-Code-Completion Source File: BatchProcessingEnvImpl.java License: Eclipse Public License 1.0 | 6 votes |
/** * Parse the -A command line arguments so that they can be delivered to * processors with {@link javax.annotation.processing.ProcessingEnvironment#getOptions()}. In Sun's Java 6 * version of javac, unlike in the Java 5 apt tool, only the -A options are * passed to processors, not the other command line options; that behavior * is repeated here. * @param args the equivalent of the args array from the main() method. * @return a map of key to value, or key to null if there is no value for * a particular key. The "-A" is stripped from the key, so a command-line * argument like "-Afoo=bar" will result in an entry with key "foo" and * value "bar". */ private Map<String, String> parseProcessorOptions(String[] args) { Map<String, String> options = new LinkedHashMap<String, String>(); for (String arg : args) { if (!arg.startsWith("-A")) { //$NON-NLS-1$ continue; } int equals = arg.indexOf('='); if (equals == 2) { // option begins "-A=" - not valid Exception e = new IllegalArgumentException("-A option must have a key before the equals sign"); //$NON-NLS-1$ throw new AbortCompilation(null, e); } if (equals == arg.length() - 1) { // option ends with "=" - not valid options.put(arg.substring(2, equals), null); } else if (equals == -1) { // no value options.put(arg.substring(2), null); } else { // value and key options.put(arg.substring(2, equals), arg.substring(equals + 1)); } } return options; }
Example 11
Source Project: java-hamcrest Source File: IsPojo.java License: Apache License 2.0 | 6 votes |
@Override protected boolean matchesSafely(A item, Description mismatchDescription) { if (!cls().isInstance(item)) { mismatchDescription.appendText("not an instance of " + cls().getName()); return false; } final Map<String, Consumer<Description>> mismatches = new LinkedHashMap<>(); methodHandlers().forEach( (methodName, handler) -> matchMethod(item, handler).ifPresent(descriptionConsumer -> mismatches.put(methodName, descriptionConsumer))); if (!mismatches.isEmpty()) { mismatchDescription.appendText(cls().getSimpleName()).appendText(" "); DescriptionUtils.describeNestedMismatches( methodHandlers().keySet(), mismatchDescription, mismatches, IsPojo::describeMethod); return false; } return true; }
Example 12
Source Project: hottub Source File: KeyValueOption.java License: GNU General Public License v2.0 | 6 votes |
private void initialize() { if (getValue() == null) { return; } map = new LinkedHashMap<>(); final StringTokenizer st = new StringTokenizer(getValue(), ","); while (st.hasMoreElements()) { final String token = st.nextToken(); final String[] keyValue = token.split(":"); if (keyValue.length == 1) { map.put(keyValue[0], ""); } else if (keyValue.length == 2) { map.put(keyValue[0], keyValue[1]); } else { throw new IllegalArgumentException(token); } } }
Example 13
Source Project: jdk8u_nashorn Source File: KeyValueOption.java License: GNU General Public License v2.0 | 6 votes |
private void initialize() { if (getValue() == null) { return; } map = new LinkedHashMap<>(); final StringTokenizer st = new StringTokenizer(getValue(), ","); while (st.hasMoreElements()) { final String token = st.nextToken(); final String[] keyValue = token.split(":"); if (keyValue.length == 1) { map.put(keyValue[0], ""); } else if (keyValue.length == 2) { map.put(keyValue[0], keyValue[1]); } else { throw new IllegalArgumentException(token); } } }
Example 14
Source Project: alfresco-repository Source File: WorkflowServiceImpl.java License: GNU Lesser General Public License v3.0 | 6 votes |
private Map<String, List<String>> batchByEngineId(List<String> workflowIds) { Map<String, List<String>> workflows = new LinkedHashMap<String, List<String>>(workflowIds.size() * 2); for (String workflowId: workflowIds) { String engineId = BPMEngineRegistry.getEngineId(workflowId); List <String> engineWorkflows = workflows.get(engineId); if (engineWorkflows == null) { engineWorkflows = new LinkedList<String>(); workflows.put(engineId, engineWorkflows); } engineWorkflows.add(workflowId); } return workflows; }
Example 15
Source Project: flair-registry Source File: EurekaResource.java License: Apache License 2.0 | 6 votes |
private List<Map<String, Object>> getApplications() { List<Application> sortedApplications = getRegistry().getSortedApplications(); ArrayList<Map<String, Object>> apps = new ArrayList<>(); for (Application app : sortedApplications) { LinkedHashMap<String, Object> appData = new LinkedHashMap<>(); apps.add(appData); appData.put("name", app.getName()); List<Map<String, Object>> instances = new ArrayList<>(); for (InstanceInfo info : app.getInstances()) { Map<String, Object> instance = new HashMap<>(); instance.put("instanceId", info.getInstanceId()); instance.put("homePageUrl", info.getHomePageUrl()); instance.put("healthCheckUrl", info.getHealthCheckUrl()); instance.put("statusPageUrl", info.getStatusPageUrl()); instance.put("status", info.getStatus().name()); instance.put("metadata", info.getMetadata()); instances.add(instance); } appData.put("instances", instances); } return apps; }
Example 16
Source Project: cxf Source File: JsonWebKeys.java License: Apache License 2.0 | 6 votes |
public Map<KeyOperation, List<JsonWebKey>> getKeyOperationMap() { List<JsonWebKey> keys = getKeys(); if (keys == null) { return Collections.emptyMap(); } Map<KeyOperation, List<JsonWebKey>> map = new LinkedHashMap<>(); for (JsonWebKey key : keys) { List<KeyOperation> ops = key.getKeyOperation(); if (ops != null) { for (KeyOperation op : ops) { List<JsonWebKey> list = map.get(op); if (list == null) { list = new LinkedList<>(); map.put(op, list); } list.add(key); } } } return map; }
Example 17
Source Project: canal-1.1.3 Source File: OracleSyncTest.java License: Apache License 2.0 | 6 votes |
@Test public void test01() { Dml dml = new Dml(); dml.setDestination("example"); dml.setTs(new Date().getTime()); dml.setType("INSERT"); dml.setDatabase("mytest"); dml.setTable("user"); List<Map<String, Object>> dataList = new ArrayList<>(); Map<String, Object> data = new LinkedHashMap<>(); dataList.add(data); data.put("id", 1L); data.put("name", "Eric"); data.put("role_id", 1L); data.put("c_time", new Date()); data.put("test1", "sdfasdfawe中国asfwef"); dml.setData(dataList); rdbAdapter.sync(Collections.singletonList(dml)); }
Example 18
Source Project: opentelemetry-java Source File: B3PropagatorTest.java License: Apache License 2.0 | 5 votes |
@Test public void inject_invalidContext_SingleHeader() { Map<String, String> carrier = new LinkedHashMap<>(); b3PropagatorSingleHeader.inject( withSpanContext( SpanContext.create( TraceId.getInvalid(), SpanId.getInvalid(), SAMPLED_TRACE_OPTIONS, TraceState.builder().set("foo", "bar").build()), Context.current()), carrier, setter); assertThat(carrier).hasSize(0); }
Example 19
Source Project: moshi Source File: MapJsonAdapterTest.java License: Apache License 2.0 | 5 votes |
@Test public void mapWithNullKeyFailsToEmit() throws Exception { Map<String, Boolean> map = new LinkedHashMap<>(); map.put(null, true); try { toJson(String.class, Boolean.class, map); fail(); } catch (JsonDataException expected) { assertThat(expected).hasMessage("Map key is null at $."); } }
Example 20
Source Project: tiktok4j Source File: JokeAITikTokImpl.java License: MIT License | 5 votes |
@Override public JsonNode searchDiscover(String keyword, int cursor) { String url = Configurations.JOKE_AI_TIKTOK_API_BASE_URL + "/search/discover"; Map<String, Object> queryParameterMap = new LinkedHashMap<>(); queryParameterMap.put("keyword", keyword); queryParameterMap.put("cursor", cursor); return HttpClientHelper.getHttpResponse(UrlHelper.addQueryParameterToUrl(url, queryParameterMap)).get(KEY_DATA); }
Example 21
Source Project: bamboobsc Source File: EmployeeLogicServiceImpl.java License: Apache License 2.0 | 5 votes |
private void getTreeData(String basePath, Map<String, Object> putObject, List<EmployeeVO> searchList, String supOid) throws Exception { List<String> childList = new LinkedList<String>(); this.getChildEmpLevelOne(searchList, supOid, childList); if (childList.size()<1) { return; } for (String childEmpOid : childList) { EmployeeVO emp = this.getEmployeeFromSearchList(searchList, childEmpOid, false); EmployeeVO childEmp = this.getEmployeeFromSearchList(searchList, childEmpOid, true); if (emp==null) { continue; } Map<String, Object> thePutObject=null; @SuppressWarnings("unchecked") List<Map<String, Object>> childrenList = (List<Map<String, Object>>)putObject.get("children"); if (childrenList==null) { childrenList=new LinkedList<Map<String, Object>>(); } Map<String, Object> nodeMap=new LinkedHashMap<String, Object>(); nodeMap.put("id", emp.getOid()); nodeMap.put("name", IconUtils.getMenuIcon(basePath, TREE_ICON_ID) + StringEscapeUtils.escapeHtml4(this.getTreeShowName(emp)) ); nodeMap.put("oid", emp.getOid() ); childrenList.add(nodeMap); putObject.put("children", childrenList); if (childEmp!=null) { thePutObject=nodeMap; } else { nodeMap.put("type", "Leaf"); thePutObject=putObject; } if (childEmp!=null) { this.getTreeData(basePath, thePutObject, searchList, childEmpOid); } } }
Example 22
Source Project: jakstab Source File: ExpressionSimplifier.java License: GNU General Public License v2.0 | 5 votes |
private ExpressionSimplifier() throws Exception { // (x < y) | (x = y) <-> x <= y File specFile = new File(Options.jakstabHome + "/ssl/simplifications.ssl"); logger.info("Reading simplifications from " + specFile.getName() + "."); SSLLexer lex = new SSLLexer(new FileInputStream(specFile)); SSLParser parser = new SSLParser(lex); SSLPreprocessor prep = new SSLPreprocessor(); parser.start(); prep.start(parser.getAST()); Map<String,SSLFunction> instrPrototypes = prep.getInstructions(); //registers = prep.getRegisters(); //registers.removeAll(statusFlags); logger.debug("-- Got " + instrPrototypes.size() + " simplification groups."); Map<RTLExpression, RTLExpression> wholeMapping = new LinkedHashMap<RTLExpression, RTLExpression>(); for (Map.Entry<String, SSLFunction> entry : instrPrototypes.entrySet()) { Map<RTLExpression, RTLExpression> mapping = prep.convertSimplificationTemplates(entry.getValue().getAST()); wholeMapping.putAll(mapping); } patterns = wholeMapping.keySet().toArray(new RTLExpression[0]); results = wholeMapping.values().toArray(new RTLExpression[0]); logger.debug("Substitution rules:"); for (int i=0; i<patterns.length; i++) logger.debug(" " + patterns[i] + " ----> " + results[i]); }
Example 23
Source Project: lucene-solr Source File: V1toV2ApiMapper.java License: Apache License 2.0 | 5 votes |
public V2Request.Builder convert(SolrParams paramsV1) { String[] list = new String[template.variables.size()]; MapWriter data = serializeToV2Format(paramsV1, list); @SuppressWarnings({"rawtypes"}) Map o = data.toMap(new LinkedHashMap<>()); return new V2Request.Builder(template.apply(s -> { int idx = template.variables.indexOf(s); return list[idx]; })) .withMethod(meta.getHttpMethod()) .withPayload(o); }
Example 24
Source Project: groovy Source File: ClassNode.java License: Apache License 2.0 | 5 votes |
public void removeField(String oldName) { ClassNode r = redirect(); if (r.fieldIndex == null) r.fieldIndex = new LinkedHashMap<>(); Map<String, FieldNode> index = r.fieldIndex; r.fields.remove(index.get(oldName)); index.remove(oldName); }
Example 25
Source Project: mPaaS Source File: QueryRequest.java License: Apache License 2.0 | 5 votes |
/** * 添加过滤器 */ public QueryRequest addFilter(String filterName, Object filterParam) { if (this.filters == null) { this.filters = new LinkedHashMap<>(); } Object temp = this.filters.get(filterName); if (temp instanceof String) { this.filters.put(filterName, StringHelper.join(temp, ";", filterParam)); } else { this.filters.put(filterName, filterParam); } return this; }
Example 26
Source Project: snake-yaml Source File: NullAliasTest.java License: Apache License 2.0 | 5 votes |
public Node representData(Object data) { Bean bean = (Bean) data; Map<String, Object> fields = new LinkedHashMap<String, Object>(2); fields.put("a", bean.getA()); fields.put("b", bean.getB()); return representMapping(MY_TAG, fields, false); }
Example 27
Source Project: util Source File: StringSplitKeyValueParser.java License: Apache License 2.0 | 5 votes |
@Override public void parse(String log) { Map<String, String> query_pairs = new LinkedHashMap<String, String>(); String[] pairs = log.split("&"); try { for (String pair : pairs) { int idx = pair.indexOf("="); final String key = URLDecoder.decode(pair.substring(0, idx)); final String value = URLDecoder.decode(pair.substring(idx + 1), "UTF-8"); query_pairs.put(key, value); } } catch(UnsupportedEncodingException ex) { LOGGER.error("Unable to url decode ",ex); } }
Example 28
Source Project: syncer Source File: SyncResult.java License: BSD 3-Clause "New" or "Revised" License | 5 votes |
/** * Not thread-safe, should not be invoked by multiple thread * @return one instance for this SyncResult */ public LinkedHashMap<String, Object> getExtras() { if (extras == null) { extras = new LinkedHashMap<>(); } return extras; }
Example 29
Source Project: hibernate-ogm-ignite Source File: IgniteTestHelper.java License: GNU Lesser General Public License v2.1 | 5 votes |
public static Map<String, String> getFields(OgmSessionFactory sessionFactory, Class<?> entityClass) { Map<String, String> result = new LinkedHashMap<>(); CacheConfiguration<Object, BinaryObject> cacheConfig = getCacheConfiguration( sessionFactory, entityClass ); for ( QueryEntity queryEntity : cacheConfig.getQueryEntities() ) { result.putAll( queryEntity.getFields() ); } return result; }
Example 30
Source Project: salt-netapi-client Source File: Jobs.java License: MIT License | 5 votes |
public static RunnerCall<Map<String, ListJobsEntry>> listJobs(Object searchMetadata, LocalDateTime startTime, LocalDateTime endTime) { LinkedHashMap<String, Object> args = new LinkedHashMap<>(); args.put("search_metadata", searchMetadata); args.put("start_time", startTime.format(DateTimeFormatter.ofPattern("yyyy-MM-dd'T'HH:mm:ss"))); args.put("end_time", endTime.format(DateTimeFormatter.ofPattern("yyyy-MM-dd'T'HH:mm:ss"))); return new RunnerCall<>("jobs.list_jobs", Optional.of(args), new TypeToken<Map<String, ListJobsEntry>>() { }); }