Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/andrucz/selection-manager

Simple and lightweight Java API to represent a selection of items. It gives you the ability to represent a selection of all items when your collection is not fully known.
https://github.com/andrucz/selection-manager

Last synced: 28 days ago
JSON representation

Simple and lightweight Java API to represent a selection of items. It gives you the ability to represent a selection of all items when your collection is not fully known.

Awesome Lists containing this project

README

        

selection-manager
=================

Simple and lightweight Java API to represent a selection of items. It gives you the ability to represent a selection of all items when your collection is not fully known.

All the interactions with this API are centralized in Selection class.

There are methods to select and deselect items, to verify if an item is selected, invert and clear the selection and select all items.

Example
-------

```java
Selection selection = new Selection();

selection.select(foo1);
selection.select(foo2);

selection.deselect(foo2);

boolean b = selection.isSelected(foo1);

selection.invert();

selection.clear();

selection.selectAll();
```

Note that after calling ```selection.selectAll()```, calls to ```selection.isSelected``` will return true for any parameter. It allows a representation of a full selection without knowing all the items involved.