Category: Collections

Using Java client to interact with MongoDB 0

Using Java client to interact with MongoDB

The official MongoDB Java Driver provides both synchronous and asynchronous interaction with MongoDB. Following are the operations supported in MongoDB : Connect How to connect to a mongodb server MongoClient mongoClient = MongoClients.create(“mongodb://host1:27017”); Cluster...

When are keys removed in Weakhashmap 0

When are keys removed in Weakhashmap

Let’s say that we want to build a cache that keeps big image objects as values, and image names as keys. We want to pick a proper map implementation for solving that problem. Using...

How can we write Java properties in a defined order 0

How can we write Java properties in a defined order

I’m using java.util.Properties’s store(Writer, String) method to store the properties. In the resulting text file, the properties are stored in a haphazard order. This is what I’m doing: Properties properties = createProperties(); properties.store(new FileWriter(file),...