I need to have a list that has an "enabled" filter such as:
[
{
    "enabled": false,
    "value": {
        "number": 0
    }
},
{
    "enabled": true,
    "value": {
        "number": 1
    }
},
{
    "enabled": false,
    "value": {
        "number": 2
    }
},
{
    "enabled": true,
    "value": {
        "number": 3
    }
}
]
If i were to iterate over this list printing each "number" using either Iterable.iterator() or a standard for loop with get(i) it'd output this:
1, 3
and it's size() would return 2. But if i go ahead and enable the first element it would print instead:
0, 1, 3
and it's size() would return 3.
Is there a standard implementation of something like this?
The list would feature operations to work on the unfiltered version of it, so as to be able to actually toggle each element.