Grouping array pending method
507993
protected function groupByPending()
    {
        $column = $this->pending['groupBy'];

        $grouped = array();
        foreach ($this->data as $object)
        {
            $grouped[$object->{$column}][] = $object;
        }

        $this->data = $grouped;
    }
89913
function groupBy(keySelector, elementSelector, resultSelector, keyComparator) {
                __assertFunction(keySelector);
                __assertFunction(elementSelector);
                __assert(__isUndefined(resultSelector) || __isFunction(resultSelector), 'resultSelector must be undefined or function!');
                __assertFunction(keyComparator);
                var groups = new Map();
                var result = void 0;
                var _iteratorNormalCompletion13 = true;
                var _didIteratorError13 = false;
                var _iteratorError13 = undefined;

                try {
                    for (var _iterator13 = self[Symbol.iterator](), _step13; !(_iteratorNormalCompletion13 = (_step13 = _iterator13.next()).done); _iteratorNormalCompletion13 = true) {
                        var val = _step13.value;

                        // Instead of checking groups.has we use our custom function since we want to treat some keys as equal even if they aren't for the Map
                        var key = __Collection.__getEqualKey(groups, keySelector(val), keyComparator);
                        var elem = elementSelector(val);
                        if (groups.has(key)) {
                            groups.get(key).push(elem);
                        } else {
                            groups.set(key, [elem]);
                        }
                    }
                } catch (err) {
                    _didIteratorError13 = true;
                    _iteratorError13 = err;
                } finally {
                    try {
                        if (!_iteratorNormalCompletion13 && _iterator13.return) {
                            _iterator13.return();
                        }
                    } finally {
                        if (_didIteratorError13) {
                            throw _iteratorError13;
                        }
                    }
                }

                if (resultSelector) {
                    // If we want to select the final result with the resultSelector, we use the built-in Select function and retrieve a new Collection
                    result = __Collection.from(groups).select(function (g) {
                        return resultSelector.apply(undefined, _toConsumableArray(g));
                    });
                } else {
                    // our result is just the groups -> return the Map
                    result = groups;
                }
                return result;
            }
325771
function groupToElements(array, n) {
  var lists = _.groupBy(array, function(element, index){
    return Math.floor(index / n);
  });

  return _.toArray(lists);
}
724445
public function addGroupBy(array $groupBy): void
    {
        if (empty($groupBy)) {
            return;
        }
        foreach ($groupBy as $i => $field) {
            $groupBy[$i] = $this->quoteName($field);
        }
        $groupByList = implode(', ', $groupBy);
        $this->statement .= ' GROUP BY ' . $groupByList . PHP_EOL;
    }
843665
public static void sort( double[] data )
	{
		int i=0,j;
		final int n = data.length;
		double a;

		// by doing the ugly exception catching it was 13% faster
		// on data set of 100000
		try {
			for( j =1; ; j++ ) {
				a=data[j];
				try {
					for( i=j; data[i-1] > a;i-- ) {
						data[i]=data[i-1];
					}
				}catch( ArrayIndexOutOfBoundsException e ) {}
				data[i]=a;
			}
		}catch( ArrayIndexOutOfBoundsException e ) {}
	}
826452
public void groupReady()
  {
    if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
      SibTr.entry(tc, "groupReady", Boolean.valueOf(groupReady));

    if(startedCount == memberCount)
      groupReady = true;

    if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
      SibTr.exit(tc, "groupReady", Boolean.valueOf(groupReady));
  }
608564
protected <T> long processUpdateGroup(T[] arr, String groupType, String groupName, Collection<CpoWhere> wheres, Collection<CpoOrderBy> orderBy, Collection<CpoNativeFunction> nativeExpressions, Session sess) throws CpoException {
    CpoClass cpoClass;
    List<CpoFunction> cpoFunctions;
    CpoFunction cpoFunction;
    CassandraBoundStatementFactory boundStatementFactory = null;
    Logger localLogger = logger;

    try {
      cpoClass = metaDescriptor.getMetaClass(arr[0]);
      cpoFunctions = cpoClass.getFunctionGroup(getGroupType(arr[0], groupType, groupName, sess), groupName).getFunctions();
      localLogger = LoggerFactory.getLogger(cpoClass.getMetaClass());

      int numStatements=0;
      localLogger.info("=================== Class=<" + arr[0].getClass() + "> Type=<" + groupType + "> Name=<" + groupName + "> =========================");
      ArrayList<CassandraBoundStatementFactory> statemetnFactories = new ArrayList<>();
      for (T obj : arr) {
        for (CpoFunction function : cpoFunctions) {
          boundStatementFactory = new CassandraBoundStatementFactory(sess, this, cpoClass, function, obj, wheres, orderBy, nativeExpressions);
          statemetnFactories.add(boundStatementFactory);
          numStatements++;
        }
      }

      executeBatchStatements(sess, statemetnFactories);

      localLogger.info("=================== " + numStatements + " Updates - Class=<" + arr[0].getClass() + "> Type=<" + groupType + "> Name=<" + groupName + "> =========================");

    } catch (Throwable t) {
      String msg = "ProcessUpdateGroup failed:" + groupType + "," + groupName + "," + arr[0].getClass().getName();
      // TODO FIX This
      // localLogger.error("bound values:" + this.parameterToString(jq));
      localLogger.error(msg, t);
      throw new CpoException(msg, t);
    }

    return unknownModifyCount;
  }
985408
public static <E extends Comparable<E>> void sort(E[] array) {
        int index = 0;
        E value = null;
        
        for(int i = 1; i < array.length; i++) {
            index = i;
            value = array[index];

            while(index > 0 && value.compareTo(array[index - 1]) < 0) {
                array[index] = array[index - 1];
                
                index--;
            }
            
            array[index] = value;
        }
    }
1284882
function _flatten(array) {
        var i = 0,
            result = [],
            queue = [ array ],
            current, ii, ll, item;
        
        while (i < queue.length) {
            current = queue[i]; // current is always an array
            for (ii = 0, ll = current.length; ii < ll; ii++) {
                item = current[ii];
                if (isArray(item)) {
                    queue.push(item);
                } else {
                    result.push(item);
                }
            }
            i++;
        }
        return result;
    }
998042
def pending():
    """"""

    signalbus = current_app.extensions['signalbus']
    pending = []
    total_pending = 0
    for signal_model in signalbus.get_signal_models():
        count = signal_model.query.count()
        if count > 0:
            pending.append((count, signal_model.__name__))
        total_pending += count
    if pending:
        pending.sort()
        max_chars = len(str(pending[-1][0]))
        for n, signal_name in pending:
            click.echo('{} of type "{}"'.format(str(n).rjust(max_chars), signal_name))
    click.echo(25 * '-')
    click.echo('Total pending: {} '.format(total_pending))
1034040
public synchronized void incrCounter(String group, String counter, long amount) {
    getGroup(group).getCounterForName(counter).increment(amount);
  }
173184
function(arr, iterator, callback) {
      callback = _doOnce(callback || noop);
      var amount = arr.length;

      if (!isArray(arr)) return callback();

      var completed = 0;
      doEach(arr, function(item) {
        iterator(item, doOnce(function(err) {
          if (err) {
            callback(err);
            callback = noop;
          } else {
            completed++;
            if (completed >= amount) callback(null);
          }
        }));
      });
    }
836198
function groupBy(keySelector, elementSelector, resultSelector, keyComparator) {
                            __assertFunction(keySelector);
                            __assertFunction(elementSelector);
                            __assert(__isUndefined(resultSelector) || __isFunction(resultSelector), 'resultSelector must be undefined or function!');
                            __assertFunction(keyComparator);
                            var groups = new Map();
                            var result = void 0;
                            var _iteratorNormalCompletion15 = true;
                            var _didIteratorError15 = false;
                            var _iteratorError15 = undefined;

                            try {
                                for (var _iterator15 = self[Symbol.iterator](), _step15; !(_iteratorNormalCompletion15 = (_step15 = _iterator15.next()).done); _iteratorNormalCompletion15 = true) {
                                    var val = _step15.value;

                                    // Instead of checking groups.has we use our custom function since we want to treat some keys as equal even if they aren't for the Map
                                    var key = __Collection.__getEqualKey(groups, keySelector(val), keyComparator);
                                    var elem = elementSelector(val);
                                    if (groups.has(key)) {
                                        groups.get(key).push(elem);
                                    } else {
                                        groups.set(key, [elem]);
                                    }
                                }
                            } catch (err) {
                                _didIteratorError15 = true;
                                _iteratorError15 = err;
                            } finally {
                                try {
                                    if (!_iteratorNormalCompletion15 && _iterator15.return) {
                                        _iterator15.return();
                                    }
                                } finally {
                                    if (_didIteratorError15) {
                                        throw _iteratorError15;
                                    }
                                }
                            }

                            if (resultSelector) {
                                // If we want to select the final result with the resultSelector, we use the built-in Select function and retrieve a new Collection
                                result = __Collection.from(groups).select(function (g) {
                                    return resultSelector.apply(undefined, _toConsumableArray(g));
                                });
                            } else {
                                // our result is just the groups -> return the Map
                                result = groups;
                            }
                            return result;
                        }
1347205
function( array, newItem, nextSiblingId, recurse, nullIfNotFound ) {
			if ( nextSiblingId ) {
				for ( var i = 0, item;
				( item = array[ i ] ); i++ ) {
					if ( item.id == nextSiblingId ) {
						array.splice( i, 0, newItem );
						return newItem;
					}

					if ( recurse && item[ recurse ] ) {
						var retval = addById( item[ recurse ], newItem, nextSiblingId, recurse, true );
						if ( retval )
							return retval;
					}
				}

				if ( nullIfNotFound )
					return null;
			}

			array.push( newItem );
			return newItem;
		}
967582
private void lsUpdateGroup(final int isa, final int first, final int last) {
        final int[] SA = this.SA;

        int a, b;
        int t;

        for (a = first; a < last; ++a) {
            if (0 <= SA[a]) {
                b = a;
                do {
                    SA[isa + SA[a]] = a;
                } while (++a < last && 0 <= SA[a]);
                SA[b] = b - a;
                if (last <= a) {
                    break;
                }
            }
            b = a;
            do {
                SA[a] = ~SA[a];
            } while (SA[++a] < 0);
            t = a;
            do {
                SA[isa + SA[b]] = t;
            } while (++b <= a);
        }
    }
1313955
@SuppressWarnings("unchecked, rawtype")
	private GroupByStateNameResults groupByStateMode(List<List<OperatorStateHandle>> previousParallelSubtaskStates) {

		//Reorganize: group by (State Name -> StreamStateHandle + StateMetaInfo)
		EnumMap<OperatorStateHandle.Mode,
				Map<String, List<Tuple2<StreamStateHandle, OperatorStateHandle.StateMetaInfo>>>> nameToStateByMode =
				new EnumMap<>(OperatorStateHandle.Mode.class);

		for (OperatorStateHandle.Mode mode : OperatorStateHandle.Mode.values()) {

			nameToStateByMode.put(
					mode,
					new HashMap<>());
		}

		for (List<OperatorStateHandle> previousParallelSubtaskState : previousParallelSubtaskStates) {
			for (OperatorStateHandle operatorStateHandle : previousParallelSubtaskState) {

				if (operatorStateHandle == null) {
					continue;
				}

				final Set<Map.Entry<String, OperatorStateHandle.StateMetaInfo>> partitionOffsetEntries =
					operatorStateHandle.getStateNameToPartitionOffsets().entrySet();

				for (Map.Entry<String, OperatorStateHandle.StateMetaInfo> e : partitionOffsetEntries) {
					OperatorStateHandle.StateMetaInfo metaInfo = e.getValue();

					Map<String, List<Tuple2<StreamStateHandle, OperatorStateHandle.StateMetaInfo>>> nameToState =
						nameToStateByMode.get(metaInfo.getDistributionMode());

					List<Tuple2<StreamStateHandle, OperatorStateHandle.StateMetaInfo>> stateLocations =
						nameToState.computeIfAbsent(
							e.getKey(),
							k -> new ArrayList<>(previousParallelSubtaskStates.size() * partitionOffsetEntries.size()));

					stateLocations.add(Tuple2.of(operatorStateHandle.getDelegateStateHandle(), e.getValue()));
				}
			}
		}

		return new GroupByStateNameResults(nameToStateByMode);
	}
1109299
public static int count(final Object array) {

    if (isArray(array)) {
      return Array.getLength(array);
    } else if (array != null) {
      throw new IllegalArgumentException("Given data is not an array.");
    } else {
      return 0;
    }
  }