Suggested change to TriangleMesh API

Martin Sladecek martin.sladecek at oracle.com
Thu Apr 11 00:31:12 PDT 2013


On 04/11/2013 02:05 AM, Jasper Potts wrote:
> *OPTION 2*
>
> The other option is to create a new set of classes that are Observable 
> primitive Arrays but does not implement Collection or List. Something 
> like:
>
> public interface ObservableFloatArray extends Iterable<Float>, 
> Observable {
> public int size();
> public void addAll(float… elements);
> public void setAll(float... elements);
> float[] toArray(float[] a)
> public float get(int index)
> public void set(int index, float value)
> public void add(float value)
> public void add(int index, float value)
> public float remove(int index);
>         ….
> }
>
> The advantage of this option is don't have a contract of parent 
> interface like "List" or "Collection" so can do anything we want. We 
> can have only primitive "float" versions of get() and set() etc. It 
> can also avoid all costly boxing/unboxing expect for implementing 
> Iterable<Float>. The down side is that it is complete new collections 
> class and can't be used with any existing Collections API.
>
> So I am not loving any of the approaches at the moment but (2) seems 
> like its the best, what do you guys think?
>
I also like option 2. We can add asObservableList() method to the 
interface that would return live ObservableList wrapper around the array 
that would work as an Option 1, so it can be used with collections API 
if necessary.

BTW, where is the requirement for "myList.get(10) == myList.get(10)"? I 
could not find it. It seems to me, that this should be legal for a List.

-Martin


More information about the openjfx-dev mailing list