Utility function.
Is used to check if Order(position for all keys) was set

@return true if order is defined for all keys
186293
public boolean isOrderSet() {
        boolean result = true;

        if (this.values.size() != this.order.size()) {
            result = false;
        }

        return result;
    }
1075673
private int findKeyOrInsertPosition(K key) {
    int newPos = 0;
    while (newPos < this.keys.length && this.comparator.compare(this.keys[newPos], key) < 0) {
      newPos++;
    }
    return newPos;
  }
640659
def _order_by_is_valid_or_none(self, params):
        
        if not "order_by" in params or not params["order_by"]:
            return True

        def _order_by_dict_is_not_well_formed(d):
            if not isinstance(d, dict):
                # Bad type.
                return True
            if "property_name" in d and d["property_name"]:
                if "direction" in d and not direction.is_valid_direction(d["direction"]):
                    # Bad direction provided.
                    return True
                for k in d:
                    if k != "property_name" and k != "direction":
                        # Unexpected key.
                        return True
                # Everything looks good!
                return False
            # Missing required key.
            return True

        # order_by is converted to a list before this point if it wasn't one before.
        order_by_list = json.loads(params["order_by"])

        for order_by in order_by_list:
            if _order_by_dict_is_not_well_formed(order_by):
                return False
        if not "group_by" in params or not params["group_by"]:
            # We must have group_by to have order_by make sense.
            return False
        return True
534809
public function hasPrimaryKey()
    {
        $empty = true;

        foreach ($this->keys as $key) {
            $empty = $empty && !$this->$key;
        }

        return !$empty;
    }
620354
def order(*ordering)
      @order = ordering.map do |c|
        if c.kind_of?(String)
          {:column => c, :ascending => true}
        else
          c.symbolize_keys!
        end
      end
      self
    end
57638
public static <K, V> Ordering<Entry<K, V>> byKeyOrdering(Ordering<K> keyOrdering) {
    return keyOrdering.onResultOf(MapUtils.<K, V>getEntryKey());
  }
558528
@Override
    public boolean isOrdered() {
        if (tc.isEntryEnabled())
            SibTr.entry(tc, "isOrdered");

        boolean returnValue = getTarget().isOrdered();
        if (tc.isEntryEnabled())
            SibTr.exit(tc, "isOrdered", new Boolean(returnValue));

        return returnValue;
    }
796223
public function isSorted()
    {
        if (Request::input(config('gbrock-tables.key_field')) == $this->getField()) {
            return true;
        }

        if (!Request::input(config('gbrock-tables.key_field')) && $this->model && $this->model->getSortingField() == $this->getField()) {
            // No sorting was requested, but this is the default field.
            return true;
        }

        return false;
    }
739065
@Override
    public boolean isOrdered() {
        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
            SibTr.entry(tc, "isOrdered");

        boolean returnValue = getTarget().isOrdered();
        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
            SibTr.exit(tc, "isOrdered", Boolean.valueOf(returnValue));

        return returnValue;
    }
754601
public static Boolean isAscendingOrder(String sorting) {
        return "desc".equalsIgnoreCase(sorting) ? Boolean.FALSE : Boolean.TRUE;
    }
325010
public boolean isSorteable() {

        Iterator<CmsListColumnDefinition> itCols = m_columns.elementList().iterator();
        while (itCols.hasNext()) {
            CmsListColumnDefinition col = itCols.next();
            if (col.isSorteable()) {
                return true;
            }
        }
        return false;
    }
395815
@Override
    public boolean isOrderDeterministic() {
        if ( ! hasTopLevelScans()) {
            // This currently applies to parent queries that do all their
            // scanning in subqueries and so take on the order determinism of
            // their subqueries. This might have to be rethought to allow
            // ordering in parent queries to effect determinism of unordered
            // "FROM CLAUSE" subquery results.
            return true;
        }

        if (hasAOneRowResult()) {
            return true;
        }

        if ( ! hasOrderByColumns() ) {
            return false;
        }

        // The nonOrdered expression list is used as a short-cut
        // -- if an expression has been determined to be
        // non-ordered when encountered as a GROUP BY expression,
        // it will also be non-ordered when encountered in the select list.
        ArrayList<AbstractExpression> nonOrdered = new ArrayList<>();

        if (isGrouped()) {
            // Does the ordering of a statements's GROUP BY columns
            // ensure determinism?
            // All display columns and order-by expressions
            // are functionally dependent on the GROUP BY
            // columns even if the display column's values
            // are not ordered or unique,
            // so ordering by ALL of the GROUP BY columns is enough
            // to get full determinism,
            // EVEN if ordering by other (dependent) expressions,
            // regardless of the placement of non-GROUP BY expressions
            // in the ORDER BY list.
            if (orderByColumnsDetermineAllColumns(m_groupByColumns, nonOrdered)) {
                return true;
            }

            if (orderByColumnsDetermineAllDisplayColumns(nonOrdered)) {
                return true;
            }

        }
        else {
            if (orderByColumnsDetermineAllDisplayColumns(nonOrdered)) {
                return true;
            }

            if (orderByColumnsCoverUniqueKeys()) {
                return true;
            }
        }
        return false;
    }
163887
public boolean isKeyReady()
  {
    if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
      SibTr.entry(tc, "isKeyReady");
    
    boolean returnValue = false;
    if(keyGroup == null)
      returnValue = ready;
    else
      //check if the ordering context is ready
      returnValue = keyGroup.isKeyReady();
    
    if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
      SibTr.exit(tc, "isKeyReady", Boolean.valueOf(returnValue));

    return returnValue;
  }
323248
public boolean orderByHashParameters(List<OrderByElement> orderByElements) {
        if (orderByElements == null) {
            return false;
        }
        for (OrderByElement orderByElement : orderByElements) {
            if (orderByElement.toString().contains("?")) {
                return true;
            }
        }
        return false;
    }
1087664
function() {
         if(this._collection.getAll()[this._pos + 1]) {
             this._hasNext = true;
         } else {
             this._hasNext = false;
         }
         
         if(!this._nextCalled) {
             this._pos ++;
             this._hasNextCalled = true;
         }

         return this._hasNext;
     }
401853
protected boolean checkSortKeyInBufferRange(BaseRow sortKey, TopNBuffer buffer) {
		Comparator<BaseRow> comparator = buffer.getSortKeyComparator();
		Map.Entry<BaseRow, Collection<BaseRow>> worstEntry = buffer.lastEntry();
		if (worstEntry == null) {
			// return true if the buffer is empty.
			return true;
		} else {
			BaseRow worstKey = worstEntry.getKey();
			int compare = comparator.compare(sortKey, worstKey);
			if (compare < 0) {
				return true;
			} else {
				return buffer.getCurrentTopNum() < getDefaultTopNSize();
			}
		}
	}
1328207
private boolean keyAlreadyExists(String newKey) {

        Collection<?> itemIds = m_table.getItemIds();
        for (Object itemId : itemIds) {
            if (m_table.getItem(itemId).getItemProperty(TableProperty.KEY).getValue().equals(newKey)) {
                return true;
            }
        }
        return false;
    }