@Test public void listView3() { ArrayLong values = new ArrayLong(5,3,1,4,2,0); ArrayInt indexes = new ArrayInt(0,3,1,4,2,5); ListNumber sortedView = ListNumbers.listView(values, indexes); assertThat(sortedView, instanceOf(ListLong.class)); assertThat(values, equalTo(new ArrayLong(5,3,1,4,2,0))); assertThat(sortedView, equalTo((ListNumber) new ArrayLong(5,4,3,2,1,0))); }
public static ListNumber listView(ListNumber list, ListInt indexes) { if (list instanceof ListDouble) { return new ListView.Double((ListDouble) list, indexes); } else if (list instanceof ListFloat) { return new ListView.Float((ListFloat) list, indexes); } else if (list instanceof ListLong) { return new ListView.Long((ListLong) list, indexes); } else if (list instanceof ListInt) { return new ListView.Int((ListInt) list, indexes); } else if (list instanceof ListShort) { return new ListView.Short((ListShort) list, indexes); } else if (list instanceof ListByte) { return new ListView.Byte((ListByte) list, indexes); } throw new UnsupportedOperationException("Not yet supported"); }
ListNumbers { public static ListNumber listView(ListNumber list, ListInt indexes) { if (list instanceof ListDouble) { return new ListView.Double((ListDouble) list, indexes); } else if (list instanceof ListFloat) { return new ListView.Float((ListFloat) list, indexes); } else if (list instanceof ListLong) { return new ListView.Long((ListLong) list, indexes); } else if (list instanceof ListInt) { return new ListView.Int((ListInt) list, indexes); } else if (list instanceof ListShort) { return new ListView.Short((ListShort) list, indexes); } else if (list instanceof ListByte) { return new ListView.Byte((ListByte) list, indexes); } throw new UnsupportedOperationException("Not yet supported"); } }
ListNumbers { public static ListNumber listView(ListNumber list, ListInt indexes) { if (list instanceof ListDouble) { return new ListView.Double((ListDouble) list, indexes); } else if (list instanceof ListFloat) { return new ListView.Float((ListFloat) list, indexes); } else if (list instanceof ListLong) { return new ListView.Long((ListLong) list, indexes); } else if (list instanceof ListInt) { return new ListView.Int((ListInt) list, indexes); } else if (list instanceof ListShort) { return new ListView.Short((ListShort) list, indexes); } else if (list instanceof ListByte) { return new ListView.Byte((ListByte) list, indexes); } throw new UnsupportedOperationException("Not yet supported"); }  }
ListNumbers { public static ListNumber listView(ListNumber list, ListInt indexes) { if (list instanceof ListDouble) { return new ListView.Double((ListDouble) list, indexes); } else if (list instanceof ListFloat) { return new ListView.Float((ListFloat) list, indexes); } else if (list instanceof ListLong) { return new ListView.Long((ListLong) list, indexes); } else if (list instanceof ListInt) { return new ListView.Int((ListInt) list, indexes); } else if (list instanceof ListShort) { return new ListView.Short((ListShort) list, indexes); } else if (list instanceof ListByte) { return new ListView.Byte((ListByte) list, indexes); } throw new UnsupportedOperationException("Not yet supported"); }  static SortedListView sortedView(ListNumber values); static SortedListView sortedView(ListNumber values, ListInt indexes); static int binarySearchValueOrLower(ListNumber values, double value); static int binarySearchValueOrHigher(ListNumber values, double value); static ListNumber linearListFromRange(final double minValue, final double maxValue, final int size); static ListNumber linearList(final double initialValue, final double increment, final int size); static boolean isLinear(ListNumber listNumber); static ListNumber toListNumber(Object primitiveArray); static ListNumber listView(ListNumber list, ListInt indexes); }
ListNumbers { public static ListNumber listView(ListNumber list, ListInt indexes) { if (list instanceof ListDouble) { return new ListView.Double((ListDouble) list, indexes); } else if (list instanceof ListFloat) { return new ListView.Float((ListFloat) list, indexes); } else if (list instanceof ListLong) { return new ListView.Long((ListLong) list, indexes); } else if (list instanceof ListInt) { return new ListView.Int((ListInt) list, indexes); } else if (list instanceof ListShort) { return new ListView.Short((ListShort) list, indexes); } else if (list instanceof ListByte) { return new ListView.Byte((ListByte) list, indexes); } throw new UnsupportedOperationException("Not yet supported"); }  static SortedListView sortedView(ListNumber values); static SortedListView sortedView(ListNumber values, ListInt indexes); static int binarySearchValueOrLower(ListNumber values, double value); static int binarySearchValueOrHigher(ListNumber values, double value); static ListNumber linearListFromRange(final double minValue, final double maxValue, final int size); static ListNumber linearList(final double initialValue, final double increment, final int size); static boolean isLinear(ListNumber listNumber); static ListNumber toListNumber(Object primitiveArray); static ListNumber listView(ListNumber list, ListInt indexes);  }