I want to use a java library that acts as a substitute for ArrayLists...This library ("Vanilla Java Collections")requires an interface to be declared in the following manner--
interface MutableBoolean {
public void setFlag(boolean b);
public boolean getFlag();
}
This is how this list is declared--
// create a huge array of MutableBoolean
HugeArrayList<MutableBoolean> hugeList = new HugeArrayBuilder<MutableBoolean>() {}.create();
List<MutableBoolean> list = hugeList;
This is how data is retrieved--
for (MutableTypes mb : list) {
boolean b1 = mb.getBoolean();
There can be multiple data types within the same interface to insert/retrieve string, integer, double etc values...
Now, in an application I am working on there is a custom variable definition--
public abstract class Variable implements MutableVariable {
abstract public byte[] toBinary();
abstract public byte[] toBinary(String charset);
abstract public String toString();
abstract public String toString(String charset);
abstract public List toList();
abstract public boolean isEmpty();
abstract public Object getWrappedObject();
----plus some more functions----
Also there is a class "NodeVariable" which extends "Variable" and another class "ListVariable" which implements Variable-- Each ListVariable has a List plus some utility functions pertaining to lists and string manipulation.
I want to implement the array substitute("Vanilla Java Collections") - which requires an interface- in place of the 'ListVariable'. But the class "Variable" is an abstract class. So I am confused here- how do I implement the interface so that I can use the ArrayList Substitute("Vanilla Java Collections") in place of "ListVariable"?
And is this possible with minimal changes to the existing code that utilises "ListVariable" i.e. by making all/most changes to the "ListVariable" class?