Note the list is not going to have a well-defined order, so it is of limited use.
We probably want to revisit this with some kind of priority/order based on ranking to make
it more useful.

@param reference
336195
@Reference(cardinality = ReferenceCardinality.MULTIPLE, policy = ReferencePolicy.DYNAMIC)
    protected void setJobExecutionEndCallbackService(IJobExecutionEndCallbackService reference) {
        jobExecutionEndCallbacks.add(reference);
    }
874337
private void sortCandidateList(ArrayList list) {
    java.util.Collections.sort(list, new java.util.Comparator() {
      public int compare(Object o1, Object o2) {
        // First sort, by score in index
        double scoreT = ( (Candidates) o1).getScore(),
            scoreU = ( (Candidates) o2).getScore();
        if (scoreU > scoreT) {
          return 1;
        }
        if (scoreU < scoreT) {
          return -1;
        }
        return 0;
      }
    }
    );
  }
700340
public static <E extends Comparable<E>> void sort(List<E> list) {
        while(!Sort.isSorted(list)) {
            FYShuffle.shuffle(list);
        }
    }
816105
private boolean cleanUp(Reference<?> reference) {
    Method finalizeReferentMethod = getFinalizeReferentMethod();
    if (finalizeReferentMethod == null) {
      return false;
    }
    do {
      /*
       * This is for the benefit of phantom references. Weak and soft
       * references will have already been cleared by this point.
       */
      reference.clear();

      if (reference == frqReference) {
        /*
         * The client no longer has a reference to the
         * FinalizableReferenceQueue. We can stop.
         */
        return false;
      }

      try {
        finalizeReferentMethod.invoke(reference);
      } catch (Throwable t) {
        logger.log(Level.SEVERE, "Error cleaning up after reference.", t);
      }

      /*
       * Loop as long as we have references available so as not to waste
       * CPU looking up the Method over and over again.
       */
    } while ((reference = queue.poll()) != null);
    return true;
  }
30581
public function addReference(Reference $reference)
    {
        $index = count($this->referenceList);
        $this->referenceList[$index] = $reference
            ->setLocator($this)
            ->setIndex($index);
        return $this;
    }
1113522
protected List<Reference> mergeReferences(
			List<? extends Reference> references1,
			List<? extends Reference> references2) {
		List<Reference> result = new ArrayList<>();
		for (Reference reference : references1) {
			addBestReferenceToList(reference, result);
		}
		for (Reference reference : references2) {
			addBestReferenceToList(reference, result);
		}
		return result;
	}
645608
public static <T extends RefCounted<T>> Refs<T> tryRef(Iterable<T> reference)
    {
        HashMap<T, Ref<T>> refs = new HashMap<>();
        for (T rc : reference)
        {
            Ref<T> ref = rc.tryRef();
            if (ref == null)
            {
                release(refs.values());
                return null;
            }
            refs.put(rc, ref);
        }
        return new Refs<T>(refs);
    }
89542
public static <T extends Comparable<? super T>> void sort(List<T> list) {
		if (useQuickSort) QuickSort.sort(list);
		else              Collections.sort(list);
	}
222108
public void setReference(final Reference reference) {
        this.reference = reference;

        if (reference instanceof PlayerReference) {
            setPlayer((PlayerReference) reference);
        }
    }
1003509
public final void expurgeQueuedReferences() {
		Reference<? extends E> obj;
		while ((obj = this.queue.poll()) != null) {
			obj.clear();
			if (this.referenceType.isInstance(obj)) {
				this.theSet.remove(this.referenceType.cast(obj));
			}
		}
	}
619581
public Resource addReference(Reference reference) {
		Resource resource = this.rdfWriter.getUri(Vocabulary.getReferenceUri(reference));

		this.referenceQueue.add(reference);
		this.referenceSubjectQueue.add(resource);

		return resource;
	}
109171
public void addDependentResourceReference(ResourceReference<?> resourceReference) {
        if (resourceReferences == null) {
            this.resourceReferences = new ArrayList<ResourceReference<?>>();
        }
        this.resourceReferences.add(resourceReference);
    }
395449
public void sortByInstanceList(final List<Instance> _targetList,
                                   final Map<Instance, Integer> _currentList)
    {
        final List<Long> idListNew = new ArrayList<>();
        final List<Object> objectListNew = new ArrayList<>();
        for (final Instance instance : _targetList) {
            if (_currentList.containsKey(instance)) {
                final Integer i = _currentList.get(instance);
                idListNew.add(this.idList.get(i));
                objectListNew.add(this.objectList.get(i));
            }
        }
        this.idList.clear();
        this.idList.addAll(idListNew);
        this.objectList.clear();
        this.objectList.addAll(objectListNew);
    }
471574
public static <E extends Comparable<E>> void sort(List<E> list) {
        Quicksort.sort(list, 0, list.size() - 1, false);
    }
607522
public boolean putReference(K key, ServiceReference<V> reference) {
        if (key == null || reference == null)
            return false;

        ConcurrentServiceReferenceSet<V> csrs = elementMap.get(key);
        if (csrs == null) {
            // No set for this key: allocate a new set that shares a context reference.
            ConcurrentServiceReferenceSet<V> newSet = new ConcurrentServiceReferenceSet<V>(referenceName, contextRef);

            // Try to add the set to the map: the value returned will be non-null if something else beat us there.
            ConcurrentServiceReferenceSet<V> currentSet = elementMap.putIfAbsent(key, newSet);
            csrs = (currentSet == null) ? newSet : currentSet;
        }

        return csrs.addReference(reference);
    }
1080348
protected void writeReference(long offset, Object reference) {
        assert referenceMessageSize != 0 : "References are not in use";
        // Is there a way to compute the element offset once and just
        // arithmetic?
        UnsafeRefArrayAccess.spElement(references, UnsafeRefArrayAccess.calcElementOffset(offset), reference);
    }
1255708
public List<Task> getTasksWithReference(Reference reference) {
		return getResourceFactory().getApiResource(
				"/task/" + reference.getType().name().toLowerCase() + "/"
						+ reference.getId() + "/").get(
				new GenericType<List<Task>>() {
				});
	}