Skip to content

Commit bd71df4

Browse files
committed
update README.md
1 parent 1ce387f commit bd71df4

1 file changed

Lines changed: 82 additions & 0 deletions

File tree

README.md

Lines changed: 82 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -200,6 +200,88 @@ var count = container.getEmailCountFrom("from@test.com");
200200
container.deleteEmails();
201201
```
202202

203+
### Collections API
204+
205+
Extended collections with dictionaries (maps) and arrays optimized for specific use cases:
206+
207+
```java
208+
// Mutable dictionary (map) with object keys
209+
var dictionary = DictionaryFactory.mutableRefToRefDictionary();
210+
dictionary.put("key1", "value1");
211+
dictionary.put("key2", "value2");
212+
213+
var value = dictionary.get("key1");
214+
215+
// Thread-safe dictionary with stamped lock
216+
var lockableDictionary = DictionaryFactory.stampedLockBasedRefToRefDictionary();
217+
var stamp = lockableDictionary.readLock();
218+
try {
219+
lockableDictionary.put("key", "value");
220+
} finally {
221+
lockableDictionary.readUnlock(stamp)
222+
}
223+
224+
// Primitive key dictionaries (no boxing overhead)
225+
var intToRefDictionary = DictionaryFactory.mutableIntToRefDictionary();
226+
intToRefDictionary.put(1, "value1");
227+
228+
var longToRefDictionary = DictionaryFactory.mutableLongToRefDictionary();
229+
longToRefDictionary.put(100L, "value2");
230+
231+
// Mutable arrays with type safety
232+
var array = ArrayFactory.mutableArray(String.class);
233+
array.add("element1");
234+
array.add("element2");
235+
236+
// Thread-safe copy-on-write array
237+
var cowArray = ArrayFactory.copyOnModifyArray(String.class);
238+
239+
// Stamped lock based thread-safe array
240+
var lockableArray = ArrayFactory.stampedLockBasedArray(String.class);
241+
```
242+
243+
### Object Pooling
244+
245+
Reusable object pools for reducing GC pressure:
246+
247+
```java
248+
// Create a pool for reusable objects
249+
var pool = PoolFactory.newReusablePool(MyReusableObject.class);
250+
251+
// Take an object from pool (or create new if empty)
252+
var obj = pool.take();
253+
254+
// Use the object...
255+
256+
// Return to pool for reuse
257+
pool.put(obj);
258+
259+
// Thread-safe pool
260+
var lockablePool = PoolFactory.newLockBasePool(MyObject.class);
261+
```
262+
263+
### Plugin System
264+
265+
Dynamic plugin loading and management:
266+
267+
```java
268+
var pluginSystem = PluginSystemFactory.newBasePluginSystem();
269+
pluginSystem.configureAppVersion(new Version("1.0.0"));
270+
pluginSystem.configureEmbeddedPluginPath(Paths.get("plugins/"));
271+
272+
// Async plugin loading
273+
pluginSystem
274+
.preLoad(ForkJoinPool.commonPool())
275+
.thenCompose(system -> system.initialize(ForkJoinPool.commonPool()))
276+
.toCompletableFuture()
277+
.join();
278+
279+
// Access extension points
280+
var extensionPoint = pluginSystem
281+
.extensionPointManager()
282+
.getExtensionPoint(MyExtension.class);
283+
```
284+
203285
## Building
204286

205287
```bash

0 commit comments

Comments
 (0)