private void editSpeakertable() { BasicTranscription transcription = table.getModel().getTranscription(); String[] speakerIDsBefore = transcription.getHead().getSpeakertable().getAllSpeakerIDs(); int[] tiersWithAutoDisplayName = transcription.getTierNumbersWithAutoDisplayName(); EditSpeakerTableDialog dialog = new EditSpeakerTableDialog(table.parent, true, transcription.getHead().getSpeakertable()); if (dialog.editSpeakertable()) { transcription.getHead().setSpeakertable(dialog.getSpeakertable()); table.getModel().getTranscription().checkSpeakers(); if (dialog.getAutoAdd()) { // auto add tiers for new speakers HashSet<String> before = new HashSet<String>(); Collections.addAll(before, speakerIDsBefore); HashSet<String> after = new HashSet<String>(); Collections.addAll(after, dialog.getSpeakertable().getAllSpeakerIDs()); if (after.removeAll(before)) { for (String newID : after) { Tier newTier = new Tier(transcription.getBody().getFreeID(), newID, "v", "t"); String displayName = newTier.getDescription(dialog.getSpeakertable()); newTier.setDisplayName(displayName); table.getModel().addTier(newTier); System.out.println("Tier inserted for " + newID); } } } transcription.makeAutoDisplayName(tiersWithAutoDisplayName); table.getModel().fireRowLabelsChanged(); table.transcriptionChanged = true; table.status("Speaker table edited"); } }
public void testRegisteredQueries() throws IOException { SearchModule module = new SearchModule(Settings.EMPTY, false, emptyList()); List<String> allSupportedQueries = new ArrayList<>(); Collections.addAll(allSupportedQueries, NON_DEPRECATED_QUERIES); Collections.addAll(allSupportedQueries, DEPRECATED_QUERIES); String[] supportedQueries = allSupportedQueries.toArray(new String[allSupportedQueries.size()]); assertThat(module.getQueryParserRegistry().getNames(), containsInAnyOrder(supportedQueries)); IndicesQueriesRegistry indicesQueriesRegistry = module.getQueryParserRegistry(); XContentParser dummyParser = XContentHelper.createParser(new BytesArray("{}")); for (String queryName : supportedQueries) { indicesQueriesRegistry.lookup( queryName, ParseFieldMatcher.EMPTY, dummyParser.getTokenLocation()); } for (String queryName : NON_DEPRECATED_QUERIES) { QueryParser<?> queryParser = indicesQueriesRegistry.lookup( queryName, ParseFieldMatcher.STRICT, dummyParser.getTokenLocation()); assertThat(queryParser, notNullValue()); } for (String queryName : DEPRECATED_QUERIES) { try { indicesQueriesRegistry.lookup( queryName, ParseFieldMatcher.STRICT, dummyParser.getTokenLocation()); fail("query is deprecated, getQueryParser should have failed in strict mode"); } catch (IllegalArgumentException e) { assertThat(e.getMessage(), containsString("Deprecated field [" + queryName + "] used")); } } }
@Override public Authorizations getAuthorizations(User user, String... additionalAuthorizations) { List<String> auths = new ArrayList<>(); Collections.addAll(auths, ((InMemoryUser) user).getAuthorizations()); Collections.addAll(auths, additionalAuthorizations); return this.graph.createAuthorizations(auths.toArray(new String[auths.size()])); }
@Override protected List<Object> getKeys() { List<Object> keys = new ArrayList<Object>(); List<IConfigurationElement> proxyElements = ToolchainExtensions.getInstance().findExplorerProxyNodes(element); List<IConfigurationElement> children = new ArrayList<IConfigurationElement>(); Collections.addAll(children, element.getChildren()); for (IConfigurationElement proxy : proxyElements) { Collections.addAll(children, proxy.getChildren()); } for (IConfigurationElement el : children) { if (ToolchainExtensions.NODE_EXTENSION_NAME.equals(el.getName())) { keys.add(new Key(el, null)); } if (ToolchainExtensions.NODE_RESOURCE_EXTENSION_NAME.equals(el.getName())) { keys.add(new Key(el, null)); } if (ToolchainExtensions.NODE_DYNAMIC_EXTENSION_NAME.equals(el.getName())) { try { IExplorerContentRetriever contentRetriever = contentRetrievers.get(el); if (contentRetriever == null) { contentRetriever = (IExplorerContentRetriever) el.createExecutableExtension("class"); contentRetriever.initialize(el.getAttribute("id"), getNode().getContext()); contentRetriever.addPropertyChangeListener(contentRetrieverListener); contentRetrievers.put(el, contentRetriever); } if (contentRetriever != null) { List<Object> contentList = contentRetriever.getChildren(); if (contentList.isEmpty()) { String emptyNodeID = el.getAttribute("empty"); if (emptyNodeID != null && !emptyNodeID.isEmpty()) { keys.add(new Key(el, null)); } } else { for (Object content : contentList) { keys.add(new Key(el, content)); } } } } catch (CoreException e) { e.printStackTrace(); } } } return keys; }
public Game(IGameControl control, String... playerNames) { players = new Player[playerNames.length]; for (int i = 0; i < players.length; i++) { players[i] = new Player(playerNames[i], i, Color.PINK, control, this); } this.control = control; IBoardBuilder builder = new EasyBoardBuilder(); Collections.addAll(intersections, builder.getIntersections()); Collections.addAll(paths, builder.getPaths()); terrains = builder.getTerrains(); for (Intersection i : intersections) { control.sendGameEvent(i.createSetupEvent()); } for (Path p : paths) { control.sendGameEvent(p.createSetupEvent()); } for (Terrain t : terrains) { control.sendGameEvent(t.createSetupEvent()); } control.sendGameEvent(new PreparationSettlementPhaseEvent(curPlayerIndex)); }
/** * Create ProcessBuilder using the java launcher from the jdk to be tested, and with any platform * specific arguments prepended. * * @param addTestVmAndJavaOptions If true, adds test.vm.opts and test.java.opts to the java * arguments. * @param command Arguments to pass to the java command. * @return The ProcessBuilder instance representing the java command. */ public static ProcessBuilder createJavaProcessBuilder( boolean addTestVmAndJavaOptions, String... command) throws Exception { String javapath = JDKToolFinder.getJDKTool("java"); ArrayList<String> args = new ArrayList<>(); args.add(javapath); Collections.addAll(args, getPlatformSpecificVMArgs()); if (addTestVmAndJavaOptions) { // -cp is needed to make sure the same classpath is used whether the test is // run in AgentVM mode or OtherVM mode. It was added to the hotspot version // of this API as part of 8077608. However, for the jdk version it is only // added when addTestVmAndJavaOptions is true in order to minimize // disruption to existing JDK tests, which have yet to be tested with -cp // being added. At some point -cp should always be added to be consistent // with what the hotspot version does. args.add("-cp"); args.add(System.getProperty("java.class.path")); Collections.addAll(args, Utils.getTestJavaOpts()); } Collections.addAll(args, command); // Reporting StringBuilder cmdLine = new StringBuilder(); for (String cmd : args) cmdLine.append(cmd).append(' '); System.out.println("Command line: [" + cmdLine.toString() + "]"); return new ProcessBuilder(args.toArray(new String[args.size()])); }
@Override public ICompletionProposal[] computeQuickAssistProposals( IQuickAssistInvocationContext invocationContext) { // prepare AssistContextUI AssistContextUI contextUI; { DartEditor editor = assistant.getEditor(); AssistContext context = editor.getAssistContext(); contextUI = new AssistContextUI(context, editor); } // prepare proposals List<ICompletionProposal> proposals = Lists.newArrayList(); // add Quick Fixes try { QuickFixProcessor_NEW qfProcessor = new QuickFixProcessor_NEW(); AnalysisError problemToFix = assistant.getProblemToFix(); ICompletionProposal[] fixProposals = qfProcessor.computeFix(contextUI, problemToFix); Collections.addAll(proposals, fixProposals); // show problem only if there is are fixes if (fixProposals.length != 0) { assistant.showProblemToFix(); } } catch (Throwable e) { DartToolsPlugin.log(e); } // add Quick Assists if (proposals.isEmpty()) { QuickAssistProcessor qaProcessor = new QuickAssistProcessor(); ICompletionProposal[] assistProposals = qaProcessor.getAssists(contextUI); Collections.addAll(proposals, assistProposals); } // done Collections.sort(proposals, new CompletionProposalComparator()); return proposals.toArray(new ICompletionProposal[proposals.size()]); }
protected int runEclipse(String message, File location, String[] args, File extensions) { File root = new File(Activator.getBundleContext().getProperty("java.home")); root = new File(root, "bin"); File exe = new File(root, "javaw.exe"); if (!exe.exists()) exe = new File(root, "java"); assertTrue("Java executable not found in: " + exe.getAbsolutePath(), exe.exists()); List<String> command = new ArrayList<String>(); Collections.addAll( command, new String[] { (new File(location == null ? output : location, getExeFolder() + "eclipse")) .getAbsolutePath(), "--launcher.suppressErrors", "-nosplash", "-vm", exe.getAbsolutePath() }); Collections.addAll(command, args); Collections.addAll(command, new String[] {"-vmArgs", "-Dosgi.checkConfiguration=true"}); // command-line if you want to run and allow a remote debugger to connect if (debug) Collections.addAll( command, new String[] { "-Xdebug", "-Xnoagent", "-Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8787" }); int result = run(message, command.toArray(new String[command.size()])); // 13 means that we wrote something out in the log file. // so try and parse it and fail via that message if we can. if (result == 13) parseExitdata(message); return result; }
private static Class[] getFactoryServices() { List<Class> services = new ArrayList<>(); Collections.addAll(services, ModelServices.FACTORIES); Collections.addAll(services, TaskServices.FACTORIES); Collections.addAll(services, MockAdapter.FACTORIES); return services.toArray(new Class[services.size()]); }
private void printRest(StringBuffer buffer) { if (!fRest.isEmpty()) { final Set<String> definedTags = new HashSet<String>(); Collections.addAll(definedTags, JSDocTag.getTags()); ISourceModule module = null; /* TODO identify module? */ Collections.addAll( definedTags, JSKeywordManager.getInstance().getKeywords(JSKeywordCategory.JS_DOC_TAG, module)); final List<Pair> unknowTags = new ArrayList<Pair>(); for (Pair p : fRest) { buffer.append("<dt>"); // $NON-NLS-1$ if (definedTags.contains(p.fTag)) { buffer.append(Character.toUpperCase(p.fTag.charAt(1))).append(p.fTag.substring(2)); if (p.fContent.length() != 0) { buffer.append(":"); } buffer.append("</dt>"); // $NON-NLS-1$ printDefinition(buffer, p.fContent, TypedDefinition.AUTO); } else { unknowTags.add(p); } } for (Pair p : unknowTags) { buffer.append("<dt>"); // $NON-NLS-1$ buffer.append(p.fTag); if (p.fContent.length() != 0) { buffer.append(":"); } buffer.append("</dt>"); // $NON-NLS-1$ printDefinition(buffer, p.fContent, TypedDefinition.AUTO); } } }
public static void main(String args[]) throws Exception { ArrayList<String> vmOpts = new ArrayList(); String testVmOptsStr = System.getProperty("test.java.opts"); if (!testVmOptsStr.isEmpty()) { String[] testVmOpts = testVmOptsStr.split(" "); Collections.addAll(vmOpts, testVmOpts); } Collections.addAll( vmOpts, new String[] { "-XX:-UseTLAB", "-XX:+UnlockDiagnosticVMOptions", "-XX:+VerifyDuringStartup", "-version" }); System.out.print("Testing:\n" + JDKToolFinder.getJDKTool("java")); for (int i = 0; i < vmOpts.size(); i += 1) { System.out.print(" " + vmOpts.get(i)); } System.out.println(); ProcessBuilder pb = ProcessTools.createJavaProcessBuilder(vmOpts.toArray(new String[vmOpts.size()])); OutputAnalyzer output = new OutputAnalyzer(pb.start()); System.out.println("Output:\n" + output.getOutput()); output.shouldContain("[Verifying"); output.shouldHaveExitValue(0); }
@SuppressWarnings("unchecked") public void testInstanceProvider() throws IOException { assertEquals(1, ServerRegistry.getInstance().getProviders().size()); ServerInstanceProvider provider = ServerRegistry.getInstance().getProviders().iterator().next(); assertTrue(provider instanceof MockInstanceProvider); MockInstanceProvider testProvider = (MockInstanceProvider) provider; testProvider.clear(); MockInstanceImplementation instance1 = MockInstanceImplementation.createInstance( testProvider, "Test server", "Test instance 1", true); // NOI18N MockInstanceImplementation instance2 = MockInstanceImplementation.createInstance( testProvider, "Test server", "Test instance 2", true); // NOI18N List<ServerInstance> step1 = new ArrayList<ServerInstance>(); Collections.addAll(step1, instance1.getServerInstance()); List<ServerInstance> step2 = new ArrayList<ServerInstance>(); Collections.addAll(step2, instance1.getServerInstance(), instance2.getServerInstance()); InstanceListener listener = new InstanceListener(step1, step2, step1, Collections.<ServerInstance>emptyList()); ServerRegistry.getInstance().addChangeListener(listener); testProvider.addInstance(instance1.getServerInstance()); testProvider.addInstance(instance2.getServerInstance()); testProvider.removeInstance(instance2.getServerInstance()); testProvider.removeInstance(instance1.getServerInstance()); }
public static void main(String[] args) { Random rand = new Random(47); // 生成新的String序列 List<String> ls = new ArrayList<String>(); print("0: " + ls); Collections.addAll(ls, "oh", "what", "a", "beautiful", "Manila", "Monday", "morning"); print("1: " + ls); // 增加新元素 String h = new String("hi"); ls.add(h); // Automatically resizes print("2: " + ls); print("3: " + ls.contains(h)); ls.remove(h); // Remove by object String n = ls.get(2); print("4: " + n + " " + ls.indexOf(n)); String m = new String("cy"); print("5: " + ls.indexOf(m)); print("6: " + ls.remove(m)); // Must be the exact object print("7: " + ls.remove(n)); print("8: " + ls); ls.add(3, new String("wonderful")); print("9: " + ls); List<String> sub = ls.subList(1, 4); print("sublist: " + sub); print("10: " + ls.containsAll(sub)); Collections.sort(sub); // In-place sort print("sorted subList: " + sub); // Order is not important in containsAll(); print("11: " + ls.containsAll(sub)); Collections.shuffle(sub, rand); print("12: " + ls.containsAll(sub)); List<String> copy = new ArrayList<String>(ls); sub = Arrays.asList(ls.get(1), ls.get(4)); // 跟书上结果好像不一样 print("sub: " + sub); copy.retainAll(sub); print("13: " + copy); copy = new ArrayList<String>(ls); // Get a fresh copy copy.remove(2); print("14: " + copy); copy.removeAll(sub); // Only remove exact objects print("15: " + copy); copy.set(1, new String("hello")); // Replace an elements print("16: " + copy); copy.addAll(2, sub); // Insert a list in the middle print("17: " + copy); print("18: " + ls.isEmpty()); ls.clear(); print("19: " + ls); print("20: " + ls.isEmpty()); List<String> ts = new ArrayList<String>(); Collections.addAll(ts, "one", "two", "three", "four"); ls.addAll(ts); print("21: " + ls); Object[] o = ls.toArray(); print("22: " + o[3]); String[] pa = ls.toArray(new String[0]); print("23: " + pa[3]); }
public static ImmutableSortedSet of(Comparable paramComparable1, Comparable paramComparable2, Comparable paramComparable3, Comparable paramComparable4, Comparable paramComparable5, Comparable paramComparable6, Comparable... paramVarArgs) { int i = paramVarArgs.length + 6; ArrayList localArrayList = new ArrayList(i); Collections.addAll(localArrayList, new Comparable[] { paramComparable1, paramComparable2, paramComparable3, paramComparable4, paramComparable5, paramComparable6 }); Collections.addAll(localArrayList, paramVarArgs); return copyOf(Ordering.natural(), localArrayList); }
public ModifierValidator( @NotNull final Modifier[] requiredModifiers, @NotNull final Modifier... modifiersNotAllowed) { this.requiredModifiers = noneOf(Modifier.class); addAll(this.requiredModifiers, requiredModifiers); this.modifiersNotAllowed = noneOf(Modifier.class); addAll(this.modifiersNotAllowed, modifiersNotAllowed); }
/** * Returns an immutable multiset containing the given elements, in order. * * @throws NullPointerException if any element is null * @since 6.0 (source-compatible since 2.0) */ @SuppressWarnings("unchecked") // public static <E> ImmutableMultiset<E> of(E e1, E e2, E e3, E e4, E e5, E e6, E... others) { int size = others.length + 6; List<E> all = new ArrayList<E>(size); Collections.addAll(all, e1, e2, e3, e4, e5, e6); Collections.addAll(all, others); return copyOf(all); }
private void findParams(List<Param> params) { Collections.addAll(params, routeParamArray); for (RequestParam param : requestParamArray) { params.add(param); } if (this instanceof PatternRoute) { Collections.addAll(params, ((PatternRoute) this).params); } }
private static PsiTypeParameter[] getAllTypeParams( PsiTypeParameterListOwner listOwner, PsiClass containingClass) { Set<PsiTypeParameter> params = new LinkedHashSet<PsiTypeParameter>(); if (listOwner != null) { Collections.addAll(params, listOwner.getTypeParameters()); } Collections.addAll(params, containingClass.getTypeParameters()); return params.toArray(new PsiTypeParameter[params.size()]); }
/** * Returns an immutable sorted multiset containing the given elements sorted by their natural * ordering. * * @throws NullPointerException if any element is null */ @SuppressWarnings("unchecked") public static <E extends Comparable<? super E>> ImmutableSortedMultiset<E> of( E e1, E e2, E e3, E e4, E e5, E e6, E... remaining) { int size = remaining.length + 6; List<E> all = Lists.newArrayListWithCapacity(size); Collections.addAll(all, e1, e2, e3, e4, e5, e6); Collections.addAll(all, remaining); return copyOf(Ordering.natural(), all); }
@Override public void addAll(MusicData... items) { synchronized (lock) { if (mOriginalValues != null) { Collections.addAll(mOriginalValues, items); } Collections.addAll(mObjects, items); } activity.runOnUiThread(reDraw); }
Comparable acomparable[]) { ArrayList arraylist = new ArrayList(6 + acomparable.length); Collections.addAll( arraylist, new Comparable[] { comparable, comparable1, comparable2, comparable3, comparable4, comparable5 }); Collections.addAll(arraylist, acomparable); return copyOf(Ordering.natural(), arraylist); }
public ICharm[] getLearnedCharms(boolean experienced) { List<ICharm> allLearnedCharms = new ArrayList<ICharm>(); for (ILearningCharmGroup group : getAllGroups()) { Collections.addAll(allLearnedCharms, group.getCreationLearnedCharms()); if (experienced) { Collections.addAll(allLearnedCharms, group.getExperienceLearnedCharms()); } } return allLearnedCharms.toArray(new ICharm[allLearnedCharms.size()]); }
/** * Adds the specified items at the end of the array. * * @param items The items to add at the end of the array. */ public void addAll(T... items) { synchronized (mLock) { if (mOriginalValues != null) { Collections.addAll(mOriginalValues, items); } else { Collections.addAll(mObjects, items); } } if (mNotifyOnChange) notifyDataSetChanged(); }
private String[] getCurrentlySupportedConfigLocations() { List<String> supportedConfigLocations = new ArrayList<String>(); if (isClassAvailable("com.fasterxml.jackson.dataformat.yaml.YAMLParser")) { Collections.addAll(supportedConfigLocations, "log4j2.yaml", "log4j2.yml"); } if (isClassAvailable("com.fasterxml.jackson.databind.ObjectMapper")) { Collections.addAll(supportedConfigLocations, "log4j2.json", "log4j2.jsn"); } supportedConfigLocations.add("log4j2.xml"); return supportedConfigLocations.toArray(new String[supportedConfigLocations.size()]); }
@Override public ELEval createELEval(String configName, Class<?>... elDefClasses) { List<Class> classes = new ArrayList<>(); Class[] configClasses = configToElDefMap.get(configName); if (configClasses != null) { Collections.addAll(classes, configClasses); } if (elDefClasses != null) { Collections.addAll(classes, elDefClasses); } return new ELEvaluator(configName, constants, classes.toArray(new Class[classes.size()])); }
public static boolean filterEquals(ClassFilter[] filters1, ClassFilter[] filters2) { if (filters1.length != filters2.length) { return false; } final Set<ClassFilter> f1 = new HashSet<ClassFilter>(Math.max((int) (filters1.length / .75f) + 1, 16)); final Set<ClassFilter> f2 = new HashSet<ClassFilter>(Math.max((int) (filters2.length / .75f) + 1, 16)); Collections.addAll(f1, filters1); Collections.addAll(f2, filters2); return f2.equals(f1); }
@Override public Configurable[] getConfigurables() { if (!isInitialized) { ArrayList<Configurable> list = new ArrayList<Configurable>(); if (super.myEp.dynamic) { Composite composite = cast(Composite.class, this); if (composite != null) { Collections.addAll(list, composite.getConfigurables()); } } if (super.myEp.children != null) { for (ConfigurableEP ep : super.myEp.getChildren()) { if (ep.isAvailable()) { list.add((Configurable) wrapConfigurable(ep)); } } } if (super.myEp.childrenEPName != null) { Object[] extensions = Extensions.getArea(super.myEp.getProject()) .getExtensionPoint(super.myEp.childrenEPName) .getExtensions(); if (extensions.length > 0) { if (extensions[0] instanceof ConfigurableEP) { for (Object object : extensions) { list.add((Configurable) wrapConfigurable((ConfigurableEP) object)); } } else if (!super.myEp.dynamic) { Composite composite = cast(Composite.class, this); if (composite != null) { Collections.addAll(list, composite.getConfigurables()); } } } } Collections.addAll(list, myKids); // sort configurables is needed for (Configurable configurable : list) { if (configurable instanceof Weighted) { if (((Weighted) configurable).getWeight() != 0) { myComparator = COMPARATOR; Collections.sort(list, myComparator); break; } } } myKids = ArrayUtil.toObjectArray(list, Configurable.class); isInitialized = true; } return myKids; }
@Override public void loadState(Element state) { try { DefaultJDOMExternalizer.readExternal(this, state); if (myNullables.isEmpty()) { Collections.addAll(myNullables, DEFAULT_NULLABLES); } if (myNotNulls.isEmpty()) { Collections.addAll(myNotNulls, DEFAULT_NOT_NULLS); } } catch (InvalidDataException e) { LOG.error(e); } }
/** * This method is used to update the Race collection. It will replace the existing Race with the * current Race and then if the current race is MORE, then it will add remaining new race inside * the collection. If the new Race is LESSER than existing then it will set the remaining * existing(after replacing with current race) to null. This logic is implemented to avoid * unnecessary null records in the database. * * @return */ private Participant updateParticipantRaceCollection( Participant existingParticipant, Participant participant) { final Race[] existRaceArray = (Race[]) existingParticipant .getRaceCollection() .toArray(new Race[existingParticipant.getRaceCollection().size()]); final Race[] newRaceArray = (Race[]) participant .getRaceCollection() .toArray(new Race[participant.getRaceCollection().size()]); final int existRaceCount = existRaceArray.length; final int newRaceCount = newRaceArray.length; // if the existing Race are more than the new/incoming Race if (existRaceCount >= newRaceCount) { int i = 0; for (; i < newRaceCount; i++) { // Iterate(till newRaceCount) & Replace the existing Race with the new/incoming Race existRaceArray[i].setRaceName(newRaceArray[i].getRaceName()); existRaceArray[i].setParticipant(newRaceArray[i].getParticipant()); } for (; i < existRaceCount; i++) { // set the remaining(more) existing Race to NULL existRaceArray[i].setRaceName(null); existRaceArray[i].setParticipant(null); } final Set<Race> mySet = new HashSet<Race>(); Collections.addAll(mySet, existRaceArray); participant.setRaceCollection(mySet); } else { // if the existing Race are LESS than the new/incoming Race int i = 0; for (; i < existRaceCount; i++) { // Iterate(till existRaceCount) & Replace the existing Race with the new/incoming Race existRaceArray[i].setRaceName(newRaceArray[i].getRaceName()); existRaceArray[i].setParticipant(newRaceArray[i].getParticipant()); } final Set<Race> mySet = new HashSet<Race>(); Collections.addAll(mySet, existRaceArray); participant.setRaceCollection(mySet); for (; i < newRaceCount; i++) { // add the remaining left new/incoming Race in the collection participant.getRaceCollection().add(newRaceArray[i]); } } return participant; }
private String[] permute(String[] params, int fromIndex) { String[] nullVersion = Arrays.copyOf(params, params.length); nullVersion[fromIndex] = null; if (params.length == fromIndex + 1) { return new String[] {createKey(database, params), createKey(database, nullVersion)}; } else { List<String> permutations = new ArrayList<String>(); Collections.addAll(permutations, permute(params, fromIndex + 1)); Collections.addAll(permutations, permute(nullVersion, fromIndex + 1)); return permutations.toArray(new String[permutations.size()]); } }