@Override public int compareTo(Request<T> other) { Priority left = this.getPriority(); Priority right = other.getPriority(); return left == right ? this.mSequence - other.mSequence : right.ordinal() - left.ordinal(); }
/** * Our comparator sorts from high to low priority, and secondarily by sequence number to provide * FIFO ordering. */ @Override public int compareTo(Request<T> other) { Priority left = this.getPriority(); Priority right = other.getPriority(); // High-priority requests are "lesser" so they are sorted to the front. // Equal priorities are sorted by sequence number to provide FIFO ordering. return left == right ? this.mSequence - other.mSequence : right.ordinal() - left.ordinal(); }
public void setPriority(Priority p) { priorityDB = p.ordinal(); priority = p; // Log.v("TodoItem-Priority = ", String.valueOf(priorityDB)); }