Java Examples for java.util.HashMap
The following java examples will help you to understand the usage of java.util.HashMap. These source code samples are taken from different open source projects.
Example 1
Project: heapaudit-master File: TestHashMap.java View source code |
// Test allocation of HashMap. @Test public void HashMap() { clear(); HashMap<Integer, Integer> hashmap = new HashMap<Integer, Integer>(); for (int i = 0; i < 100; ++i) { hashmap.put(i, i); assertTrue(expect("java.util.HashMap$Entry", -1, 32)); } assertTrue(expect("java.util.HashMap", -1, 48)); assertTrue(expect("java.util.HashMap$Entry", 16, 80)); assertTrue(expect("java.util.HashMap$Entry", 32, 144)); assertTrue(expect("java.util.HashMap$Entry", 64, 272)); assertTrue(expect("java.util.HashMap$Entry", 128, 528)); assertTrue(expect("java.util.HashMap$Entry", 256, 1040)); assertTrue(empty()); }
Example 2
Project: bigbluebutton-master File: MessageToJson.java View source code |
public static String registerUserToJson(RegisterUserMessage message) { HashMap<String, Object> payload = new HashMap<String, Object>(); payload.put(Constants.MEETING_ID, message.meetingID); payload.put(Constants.NAME, message.fullname); payload.put(Constants.USER_ID, message.internalUserId); payload.put(Constants.ROLE, message.role); payload.put(Constants.EXT_USER_ID, message.externUserID); payload.put(Constants.AUTH_TOKEN, message.authToken); payload.put(Constants.AVATAR_URL, message.avatarURL); java.util.HashMap<String, Object> header = MessageBuilder.buildHeader(RegisterUserMessage.REGISTER_USER, message.VERSION, null); return MessageBuilder.buildJson(header, payload); }
Example 3
Project: gluster-ovirt-poc-master File: ConnectStorageServerVDSCommand.java View source code |
@SuppressWarnings("unchecked")
protected Map<String, String>[] BuildStructFromConnectionListObject() {
Map<String, String>[] result = new HashMap[getParameters().getConnectionList().size()];
int i = 0;
for (storage_server_connections connection : getParameters().getConnectionList()) {
result[i] = CreateStructFromConnection(connection);
i++;
}
return result;
}
Example 4
Project: iterator-master File: Object.java View source code |
public static java.lang.Object decode_(com.jsoniter.JsonIterator iter) throws java.io.IOException { java.util.HashMap map = (java.util.HashMap) com.jsoniter.CodegenAccess.resetExistingObject(iter); if (iter.readNull()) { return null; } if (map == null) { map = new java.util.HashMap(); } if (!com.jsoniter.CodegenAccess.readObjectStart(iter)) { return map; } do { String field = com.jsoniter.CodegenAccess.readObjectFieldAsString(iter); map.put(field, (java.lang.Object) iter.read()); } while (com.jsoniter.CodegenAccess.nextToken(iter) == ','); return map; }
Example 5
Project: jwt4j-master File: DisabledRegisteredClaimsValidatorTest.java View source code |
@Test
public void shouldDoNothing() {
//given
final DisabledRegisteredClaimsValidator disabledRegisteredClaimsValidator = new DisabledRegisteredClaimsValidator();
//when
disabledRegisteredClaimsValidator.validate(new HashMap<String, String>() {
{
put(JWTConstants.JWT_ID, "Jwt-ID");
}
});
//then
}
Example 6
Project: spyjar-master File: InstantiatorTest.java View source code |
@SuppressWarnings("unchecked") public void testSimple() throws Exception { Instantiator<Map> i = new Instantiator<Map>("java.util.HashMap"); assertTrue(i.getInstance() instanceof HashMap); assertSame(i.getInstance(), i.getInstance()); Instantiator<Map> i2 = new Instantiator<Map>("java.util.HashMap"); assertTrue(i2.getInstance() instanceof HashMap); assertNotSame(i2.getInstance(), i.getInstance()); assertEquals(i.getInstance(), i2.getInstance()); }