Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorStephan Herrmann2017-05-28 15:00:50 +0000
committerStephan Herrmann2017-07-05 23:05:27 +0000
commit905307ba95aeaa4570286fd98cd5fee0aa7ea5d7 (patch)
tree0fbe7ffb927687aa4e831d8be9b7e7322d0a48e3 /org.eclipse.jdt.core/compiler/org/eclipse/jdt/core/compiler/CharOperation.java
parent2b919290ce0d8914c8cf0166e89ffbd7f02724c1 (diff)
downloadeclipse.jdt.core-905307ba95aeaa4570286fd98cd5fee0aa7ea5d7.tar.gz
eclipse.jdt.core-905307ba95aeaa4570286fd98cd5fee0aa7ea5d7.tar.xz
eclipse.jdt.core-905307ba95aeaa4570286fd98cd5fee0aa7ea5d7.zip
Bug 517808: [9][compiler] Implement lookup (module, package, type) based
on the 2017-05-25 version of JLS Change-Id: I705cd408bfe04b0ff9c8a7085a4112c15650f890
Diffstat (limited to 'org.eclipse.jdt.core/compiler/org/eclipse/jdt/core/compiler/CharOperation.java')
-rw-r--r--org.eclipse.jdt.core/compiler/org/eclipse/jdt/core/compiler/CharOperation.java34
1 files changed, 33 insertions, 1 deletions
diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/core/compiler/CharOperation.java b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/core/compiler/CharOperation.java
index 7cffb92d52..a63dadab63 100644
--- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/core/compiler/CharOperation.java
+++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/core/compiler/CharOperation.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2016 IBM Corporation and others.
+ * Copyright (c) 2000, 2017 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -18,6 +18,7 @@
package org.eclipse.jdt.core.compiler;
import java.util.Arrays;
+import java.util.List;
import org.eclipse.jdt.internal.compiler.parser.ScannerHelper;
@@ -833,6 +834,22 @@ public static String charToString(char[] charArray) {
}
/**
+ * Converts the given list of strings to an array of equal size,
+ * containing the individual strings converted to char[] each.
+ *
+ * @param stringList
+ * @return an array of char[], representing the elements in the input list, or {@code null} if the list was {@code null}.
+ * @since 3.13 BETA_JAVA9
+ */
+public static char[][] toCharArrays(List<String> stringList) {
+ if (stringList == null)
+ return null;
+ char[][] result = new char[stringList.size()][];
+ for (int i = 0; i < result.length; i++)
+ result[i] = stringList.get(i).toCharArray();
+ return result;
+}
+/**
* Answers a new array adding the second array at the end of first array.
* It answers null if the first and second are null.
* If the first array is null, then a new array char[][] is created with second.
@@ -1868,6 +1885,21 @@ public static final boolean contains(char[] characters, char[] array) {
}
/**
+ * Does the given array contain a char sequence that is equal to the give sequence?
+ * @param array
+ * @param sequence
+ * @return true if sequence is equal to an element in array
+ * @since 3.13 BETA_JAVA9
+ */
+public static boolean containsEqual(char[][] array, char[] sequence) {
+ for (int i = 0; i < array.length; i++) {
+ if (equals(array[i], sequence))
+ return true;
+ }
+ return false;
+}
+
+/**
* Answers a deep copy of the toCopy array.
*
* @param toCopy the array to copy

Back to the top