getItems static method

List<Object> getItems(
  1. PriorityQueue kNearestNeighbors
)

Implementation

static List<Object> getItems(PriorityQueue kNearestNeighbors) {
  /**
   * Iterate the K Nearest Neighbour Queue and retrieve the item from each BoundablePair
   * in this queue
   */
  List<Object> items = []; //..length = kNearestNeighbors.size();
  // int count = 0;
  while (!kNearestNeighbors.isEmpty()) {
    BoundablePair bp = kNearestNeighbors.poll() as BoundablePair;
    items.add((bp.getBoundable(0) as ItemBoundable).getItem());
    // items[count] = (bp.getBoundable(0) as ItemBoundable).getItem();
    // count++;
  }
  return items;
}