org.eclipse.jdt.internal.core.util.Util.sortCopy()方法的使用及代码示例

x33g5p2x  于2022-02-01 转载在 其他  
字(13.9k)|赞(0)|评价(0)|浏览(257)

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

Util.sortCopy介绍

[英]Sorts an array of Strings, returning a new array with the sorted items. The original array is left untouched.
[中]对字符串数组进行排序,返回一个包含已排序项的新数组。原始数组保持不变。

代码示例

代码示例来源:origin: org.eclipse.jdt/org.eclipse.jdt.core

  1. /**
  2. * Compares two String arrays using equals() on the elements.
  3. * The arrays are first sorted.
  4. * Either or both arrays may be null.
  5. * Returns true if both are null.
  6. * Returns false if only one is null.
  7. * If both are arrays, returns true iff they have the same length and
  8. * iff, after sorting both arrays, all elements compare true with equals.
  9. * The original arrays are left untouched.
  10. */
  11. public static boolean equalArraysOrNullSortFirst(String[] a, String[] b) {
  12. if (a == b) return true;
  13. if (a == null || b == null) return false;
  14. int len = a.length;
  15. if (len != b.length) return false;
  16. if (len >= 2) { // only need to sort if more than two items
  17. a = sortCopy(a);
  18. b = sortCopy(b);
  19. }
  20. for (int i = 0; i < len; ++i) {
  21. if (!a[i].equals(b[i])) return false;
  22. }
  23. return true;
  24. }

代码示例来源:origin: org.eclipse.scout.sdk.deps/org.eclipse.jdt.core

  1. /**
  2. * Compares two arrays using equals() on the elements.
  3. * The arrays are first sorted.
  4. * Either or both arrays may be null.
  5. * Returns true if both are null.
  6. * Returns false if only one is null.
  7. * If both are arrays, returns true iff they have the same length and
  8. * iff, after sorting both arrays, all elements compare true with equals.
  9. * The original arrays are left untouched.
  10. */
  11. public static boolean equalArraysOrNullSortFirst(Comparable[] a, Comparable[] b) {
  12. if (a == b) return true;
  13. if (a == null || b == null) return false;
  14. int len = a.length;
  15. if (len != b.length) return false;
  16. if (len >= 2) { // only need to sort if more than two items
  17. a = sortCopy(a);
  18. b = sortCopy(b);
  19. }
  20. for (int i = 0; i < len; ++i) {
  21. if (!a[i].equals(b[i])) return false;
  22. }
  23. return true;
  24. }

代码示例来源:origin: com.google.code.maven-play-plugin.org.eclipse.jdt/org.eclipse.jdt.core

  1. /**
  2. * Compares two arrays using equals() on the elements.
  3. * The arrays are first sorted.
  4. * Either or both arrays may be null.
  5. * Returns true if both are null.
  6. * Returns false if only one is null.
  7. * If both are arrays, returns true iff they have the same length and
  8. * iff, after sorting both arrays, all elements compare true with equals.
  9. * The original arrays are left untouched.
  10. */
  11. public static boolean equalArraysOrNullSortFirst(Comparable[] a, Comparable[] b) {
  12. if (a == b) return true;
  13. if (a == null || b == null) return false;
  14. int len = a.length;
  15. if (len != b.length) return false;
  16. if (len >= 2) { // only need to sort if more than two items
  17. a = sortCopy(a);
  18. b = sortCopy(b);
  19. }
  20. for (int i = 0; i < len; ++i) {
  21. if (!a[i].equals(b[i])) return false;
  22. }
  23. return true;
  24. }

代码示例来源:origin: org.jibx.config.3rdparty.org.eclipse/org.eclipse.jdt.core

  1. /**
  2. * Compares two String arrays using equals() on the elements.
  3. * The arrays are first sorted.
  4. * Either or both arrays may be null.
  5. * Returns true if both are null.
  6. * Returns false if only one is null.
  7. * If both are arrays, returns true iff they have the same length and
  8. * iff, after sorting both arrays, all elements compare true with equals.
  9. * The original arrays are left untouched.
  10. */
  11. public static boolean equalArraysOrNullSortFirst(String[] a, String[] b) {
  12. if (a == b) return true;
  13. if (a == null || b == null) return false;
  14. int len = a.length;
  15. if (len != b.length) return false;
  16. if (len >= 2) { // only need to sort if more than two items
  17. a = sortCopy(a);
  18. b = sortCopy(b);
  19. }
  20. for (int i = 0; i < len; ++i) {
  21. if (!a[i].equals(b[i])) return false;
  22. }
  23. return true;
  24. }

代码示例来源:origin: com.vaadin/vaadin-client-compiler-deps

  1. /**
  2. * Compares two String arrays using equals() on the elements.
  3. * The arrays are first sorted.
  4. * Either or both arrays may be null.
  5. * Returns true if both are null.
  6. * Returns false if only one is null.
  7. * If both are arrays, returns true iff they have the same length and
  8. * iff, after sorting both arrays, all elements compare true with equals.
  9. * The original arrays are left untouched.
  10. */
  11. public static boolean equalArraysOrNullSortFirst(String[] a, String[] b) {
  12. if (a == b) return true;
  13. if (a == null || b == null) return false;
  14. int len = a.length;
  15. if (len != b.length) return false;
  16. if (len >= 2) { // only need to sort if more than two items
  17. a = sortCopy(a);
  18. b = sortCopy(b);
  19. }
  20. for (int i = 0; i < len; ++i) {
  21. if (!a[i].equals(b[i])) return false;
  22. }
  23. return true;
  24. }

代码示例来源:origin: trylimits/Eclipse-Postfix-Code-Completion

  1. /**
  2. * Compares two String arrays using equals() on the elements.
  3. * The arrays are first sorted.
  4. * Either or both arrays may be null.
  5. * Returns true if both are null.
  6. * Returns false if only one is null.
  7. * If both are arrays, returns true iff they have the same length and
  8. * iff, after sorting both arrays, all elements compare true with equals.
  9. * The original arrays are left untouched.
  10. */
  11. public static boolean equalArraysOrNullSortFirst(String[] a, String[] b) {
  12. if (a == b) return true;
  13. if (a == null || b == null) return false;
  14. int len = a.length;
  15. if (len != b.length) return false;
  16. if (len >= 2) { // only need to sort if more than two items
  17. a = sortCopy(a);
  18. b = sortCopy(b);
  19. }
  20. for (int i = 0; i < len; ++i) {
  21. if (!a[i].equals(b[i])) return false;
  22. }
  23. return true;
  24. }

代码示例来源:origin: org.eclipse.jdt/org.eclipse.jdt.core

  1. /**
  2. * Compares two arrays using equals() on the elements.
  3. * The arrays are first sorted.
  4. * Either or both arrays may be null.
  5. * Returns true if both are null.
  6. * Returns false if only one is null.
  7. * If both are arrays, returns true iff they have the same length and
  8. * iff, after sorting both arrays, all elements compare true with equals.
  9. * The original arrays are left untouched.
  10. */
  11. public static boolean equalArraysOrNullSortFirst(Comparable[] a, Comparable[] b) {
  12. if (a == b) return true;
  13. if (a == null || b == null) return false;
  14. int len = a.length;
  15. if (len != b.length) return false;
  16. if (len >= 2) { // only need to sort if more than two items
  17. a = sortCopy(a);
  18. b = sortCopy(b);
  19. }
  20. for (int i = 0; i < len; ++i) {
  21. if (!a[i].equals(b[i])) return false;
  22. }
  23. return true;
  24. }

代码示例来源:origin: org.eclipse.tycho/org.eclipse.jdt.core

  1. /**
  2. * Compares two arrays using equals() on the elements.
  3. * The arrays are first sorted.
  4. * Either or both arrays may be null.
  5. * Returns true if both are null.
  6. * Returns false if only one is null.
  7. * If both are arrays, returns true iff they have the same length and
  8. * iff, after sorting both arrays, all elements compare true with equals.
  9. * The original arrays are left untouched.
  10. */
  11. public static boolean equalArraysOrNullSortFirst(Comparable[] a, Comparable[] b) {
  12. if (a == b) return true;
  13. if (a == null || b == null) return false;
  14. int len = a.length;
  15. if (len != b.length) return false;
  16. if (len >= 2) { // only need to sort if more than two items
  17. a = sortCopy(a);
  18. b = sortCopy(b);
  19. }
  20. for (int i = 0; i < len; ++i) {
  21. if (!a[i].equals(b[i])) return false;
  22. }
  23. return true;
  24. }

代码示例来源:origin: org.eclipse.tycho/org.eclipse.jdt.core

  1. /**
  2. * Compares two String arrays using equals() on the elements.
  3. * The arrays are first sorted.
  4. * Either or both arrays may be null.
  5. * Returns true if both are null.
  6. * Returns false if only one is null.
  7. * If both are arrays, returns true iff they have the same length and
  8. * iff, after sorting both arrays, all elements compare true with equals.
  9. * The original arrays are left untouched.
  10. */
  11. public static boolean equalArraysOrNullSortFirst(String[] a, String[] b) {
  12. if (a == b) return true;
  13. if (a == null || b == null) return false;
  14. int len = a.length;
  15. if (len != b.length) return false;
  16. if (len >= 2) { // only need to sort if more than two items
  17. a = sortCopy(a);
  18. b = sortCopy(b);
  19. }
  20. for (int i = 0; i < len; ++i) {
  21. if (!a[i].equals(b[i])) return false;
  22. }
  23. return true;
  24. }

代码示例来源:origin: org.eclipse.scout.sdk.deps/org.eclipse.jdt.core

  1. /**
  2. * Compares two String arrays using equals() on the elements.
  3. * The arrays are first sorted.
  4. * Either or both arrays may be null.
  5. * Returns true if both are null.
  6. * Returns false if only one is null.
  7. * If both are arrays, returns true iff they have the same length and
  8. * iff, after sorting both arrays, all elements compare true with equals.
  9. * The original arrays are left untouched.
  10. */
  11. public static boolean equalArraysOrNullSortFirst(String[] a, String[] b) {
  12. if (a == b) return true;
  13. if (a == null || b == null) return false;
  14. int len = a.length;
  15. if (len != b.length) return false;
  16. if (len >= 2) { // only need to sort if more than two items
  17. a = sortCopy(a);
  18. b = sortCopy(b);
  19. }
  20. for (int i = 0; i < len; ++i) {
  21. if (!a[i].equals(b[i])) return false;
  22. }
  23. return true;
  24. }

代码示例来源:origin: com.google.code.maven-play-plugin.org.eclipse.jdt/org.eclipse.jdt.core

  1. /**
  2. * Compares two String arrays using equals() on the elements.
  3. * The arrays are first sorted.
  4. * Either or both arrays may be null.
  5. * Returns true if both are null.
  6. * Returns false if only one is null.
  7. * If both are arrays, returns true iff they have the same length and
  8. * iff, after sorting both arrays, all elements compare true with equals.
  9. * The original arrays are left untouched.
  10. */
  11. public static boolean equalArraysOrNullSortFirst(String[] a, String[] b) {
  12. if (a == b) return true;
  13. if (a == null || b == null) return false;
  14. int len = a.length;
  15. if (len != b.length) return false;
  16. if (len >= 2) { // only need to sort if more than two items
  17. a = sortCopy(a);
  18. b = sortCopy(b);
  19. }
  20. for (int i = 0; i < len; ++i) {
  21. if (!a[i].equals(b[i])) return false;
  22. }
  23. return true;
  24. }

代码示例来源:origin: com.vaadin/vaadin-client-compiler-deps

  1. /**
  2. * Compares two arrays using equals() on the elements.
  3. * The arrays are first sorted.
  4. * Either or both arrays may be null.
  5. * Returns true if both are null.
  6. * Returns false if only one is null.
  7. * If both are arrays, returns true iff they have the same length and
  8. * iff, after sorting both arrays, all elements compare true with equals.
  9. * The original arrays are left untouched.
  10. */
  11. public static boolean equalArraysOrNullSortFirst(Comparable[] a, Comparable[] b) {
  12. if (a == b) return true;
  13. if (a == null || b == null) return false;
  14. int len = a.length;
  15. if (len != b.length) return false;
  16. if (len >= 2) { // only need to sort if more than two items
  17. a = sortCopy(a);
  18. b = sortCopy(b);
  19. }
  20. for (int i = 0; i < len; ++i) {
  21. if (!a[i].equals(b[i])) return false;
  22. }
  23. return true;
  24. }

代码示例来源:origin: org.jibx.config.3rdparty.org.eclipse/org.eclipse.jdt.core

  1. /**
  2. * Compares two arrays using equals() on the elements.
  3. * The arrays are first sorted.
  4. * Either or both arrays may be null.
  5. * Returns true if both are null.
  6. * Returns false if only one is null.
  7. * If both are arrays, returns true iff they have the same length and
  8. * iff, after sorting both arrays, all elements compare true with equals.
  9. * The original arrays are left untouched.
  10. */
  11. public static boolean equalArraysOrNullSortFirst(Comparable[] a, Comparable[] b) {
  12. if (a == b) return true;
  13. if (a == null || b == null) return false;
  14. int len = a.length;
  15. if (len != b.length) return false;
  16. if (len >= 2) { // only need to sort if more than two items
  17. a = sortCopy(a);
  18. b = sortCopy(b);
  19. }
  20. for (int i = 0; i < len; ++i) {
  21. if (!a[i].equals(b[i])) return false;
  22. }
  23. return true;
  24. }

代码示例来源:origin: trylimits/Eclipse-Postfix-Code-Completion

  1. /**
  2. * Compares two arrays using equals() on the elements.
  3. * The arrays are first sorted.
  4. * Either or both arrays may be null.
  5. * Returns true if both are null.
  6. * Returns false if only one is null.
  7. * If both are arrays, returns true iff they have the same length and
  8. * iff, after sorting both arrays, all elements compare true with equals.
  9. * The original arrays are left untouched.
  10. */
  11. public static boolean equalArraysOrNullSortFirst(Comparable[] a, Comparable[] b) {
  12. if (a == b) return true;
  13. if (a == null || b == null) return false;
  14. int len = a.length;
  15. if (len != b.length) return false;
  16. if (len >= 2) { // only need to sort if more than two items
  17. a = sortCopy(a);
  18. b = sortCopy(b);
  19. }
  20. for (int i = 0; i < len; ++i) {
  21. if (!a[i].equals(b[i])) return false;
  22. }
  23. return true;
  24. }

代码示例来源:origin: org.eclipse.jdt/org.eclipse.jdt.core

  1. /**
  2. * Append a String to the given buffer representing the hierarchy for the type,
  3. * beginning with the specified indentation level.
  4. * If ascendant, shows the super types, otherwise show the sub types.
  5. */
  6. private void toString(StringBuffer buffer, IJavaElement type, int indent, boolean ascendant) {
  7. IType[] types= ascendant ? getSupertypes((IType) type) : getSubtypes((IType) type);
  8. IJavaElement[] sortedTypes = Util.sortCopy(types);
  9. for (int i= 0; i < sortedTypes.length; i++) {
  10. toString(buffer, sortedTypes[i], indent + 1);
  11. toString(buffer, sortedTypes[i], indent + 1, ascendant);
  12. }
  13. }
  14. private void toString(StringBuffer buffer, IJavaElement type, int indent) {

代码示例来源:origin: org.eclipse.scout.sdk.deps/org.eclipse.jdt.core

  1. /**
  2. * Append a String to the given buffer representing the hierarchy for the type,
  3. * beginning with the specified indentation level.
  4. * If ascendant, shows the super types, otherwise show the sub types.
  5. */
  6. private void toString(StringBuffer buffer, IJavaElement type, int indent, boolean ascendant) {
  7. IType[] types= ascendant ? getSupertypes((IType) type) : getSubtypes((IType) type);
  8. IJavaElement[] sortedTypes = Util.sortCopy(types);
  9. for (int i= 0; i < sortedTypes.length; i++) {
  10. toString(buffer, sortedTypes[i], indent + 1);
  11. toString(buffer, sortedTypes[i], indent + 1, ascendant);
  12. }
  13. }
  14. private void toString(StringBuffer buffer, IJavaElement type, int indent) {

代码示例来源:origin: trylimits/Eclipse-Postfix-Code-Completion

  1. /**
  2. * Append a String to the given buffer representing the hierarchy for the type,
  3. * beginning with the specified indentation level.
  4. * If ascendant, shows the super types, otherwise show the sub types.
  5. */
  6. private void toString(StringBuffer buffer, IJavaElement type, int indent, boolean ascendant) {
  7. IType[] types= ascendant ? getSupertypes((IType) type) : getSubtypes((IType) type);
  8. IJavaElement[] sortedTypes = Util.sortCopy(types);
  9. for (int i= 0; i < sortedTypes.length; i++) {
  10. toString(buffer, sortedTypes[i], indent + 1);
  11. toString(buffer, sortedTypes[i], indent + 1, ascendant);
  12. }
  13. }
  14. private void toString(StringBuffer buffer, IJavaElement type, int indent) {

代码示例来源:origin: org.eclipse.tycho/org.eclipse.jdt.core

  1. /**
  2. * Append a String to the given buffer representing the hierarchy for the type,
  3. * beginning with the specified indentation level.
  4. * If ascendant, shows the super types, otherwise show the sub types.
  5. */
  6. private void toString(StringBuffer buffer, IJavaElement type, int indent, boolean ascendant) {
  7. IType[] types= ascendant ? getSupertypes((IType) type) : getSubtypes((IType) type);
  8. IJavaElement[] sortedTypes = Util.sortCopy(types);
  9. for (int i= 0; i < sortedTypes.length; i++) {
  10. toString(buffer, sortedTypes[i], indent + 1);
  11. toString(buffer, sortedTypes[i], indent + 1, ascendant);
  12. }
  13. }
  14. private void toString(StringBuffer buffer, IJavaElement type, int indent) {

代码示例来源:origin: com.google.code.maven-play-plugin.org.eclipse.jdt/org.eclipse.jdt.core

  1. /**
  2. * Append a String to the given buffer representing the hierarchy for the type,
  3. * beginning with the specified indentation level.
  4. * If ascendant, shows the super types, otherwise show the sub types.
  5. */
  6. private void toString(StringBuffer buffer, IJavaElement type, int indent, boolean ascendant) {
  7. IType[] types= ascendant ? getSupertypes((IType) type) : getSubtypes((IType) type);
  8. IJavaElement[] sortedTypes = Util.sortCopy(types);
  9. for (int i= 0; i < sortedTypes.length; i++) {
  10. toString(buffer, sortedTypes[i], indent + 1);
  11. toString(buffer, sortedTypes[i], indent + 1, ascendant);
  12. }
  13. }
  14. private void toString(StringBuffer buffer, IJavaElement type, int indent) {

代码示例来源:origin: org.jibx.config.3rdparty.org.eclipse/org.eclipse.jdt.core

  1. /**
  2. * Append a String to the given buffer representing the hierarchy for the type,
  3. * beginning with the specified indentation level.
  4. * If ascendant, shows the super types, otherwise show the sub types.
  5. */
  6. private void toString(StringBuffer buffer, IJavaElement type, int indent, boolean ascendant) {
  7. IType[] types= ascendant ? getSupertypes((IType) type) : getSubtypes((IType) type);
  8. IJavaElement[] sortedTypes = Util.sortCopy(types);
  9. for (int i= 0; i < sortedTypes.length; i++) {
  10. toString(buffer, sortedTypes[i], indent + 1);
  11. toString(buffer, sortedTypes[i], indent + 1, ascendant);
  12. }
  13. }
  14. private void toString(StringBuffer buffer, IJavaElement type, int indent) {

相关文章

Util类方法