org.stjs.javascript.Array.sort()方法的使用及代码示例

x33g5p2x  于2022-01-17 转载在 JavaScript  
字(1.9k)|赞(0)|评价(0)|浏览(116)

本文整理了Java中org.stjs.javascript.Array.sort()方法的一些代码示例,展示了Array.sort()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Array.sort()方法的具体详情如下:
包路径:org.stjs.javascript.Array
类名称:Array
方法名:sort

Array.sort介绍

[英]Sorts the elements of this Array using the natural order of their string representations.

The sort is not necessarily stable (that is, elements that compare equal do not necessarily remain in their original order).

sort returns this Array.

Note1: Because non-existent property values always compare greater than undefined property values, and undefined always compares greater than any other value, undefined property values always sort to the end of the result, followed by non-existent property values.
[中]使用字符串表示形式的自然顺序对此数组的元素进行排序。
排序不一定是稳定的(即,比较相等的元素不一定保持其原始顺序)。
sort返回这个数组。
注1:由于不存在的属性值的比较总是大于未定义的属性值,且未定义的属性值的比较总是大于任何其他值,因此未定义的属性值总是排序到结果的末尾,后跟不存在的属性值。

代码示例

代码示例来源:origin: org.st-js/shared

/**
 * Sorts the elements of this <tt>Array</tt> using the natural order of their string representations.
 *
 * <p>
 * The sort is not necessarily stable (that is, elements that compare equal do not necessarily remain in their
 * original order).
 *
 * <p>
 * <tt>sort</tt> returns this <tt>Array</tt>.
 *
 * <p>
 * <strong>Note1:</strong> Because non-existent property values always compare greater than undefined property
 * values, and undefined always compares greater than any other value, undefined property values always sort to the
 * end of the result, followed by non-existent property values.
 *
 * @return this array
 */
public Array<V> sort() {
  return this.sort(null);
}

代码示例来源:origin: com.eduworks/cass.rollup

collectCompetencies(ip, listOfActivatedCompetencies, new Array<InquiryPacket>());
final AssertionProcessor me = this;
listOfActivatedCompetencies.sort(new SortFunction<String>() {
  @Override
  public int $invoke(String a, String b) {

代码示例来源:origin: com.eduworks/org.json-ld

keys.push(key);
keys.sort(new SortFunction<String>() {
  @Override
  public int $invoke(String a, String b) {

相关文章