SmartServiceInfoRefs(String service, List<Filter> filters) {
this.svc = service;
- this.filters = filters.toArray(new Filter[filters.size()]);
+ this.filters = filters.toArray(new Filter[0]);
}
/** {@inheritDoc} */
* @return the configured filters; zero-length array if none.
*/
protected Filter[] getFilters() {
- return filters.toArray(new Filter[filters.size()]);
+ return filters.toArray(new Filter[0]);
}
/** @return the pipeline that matches and executes this chain. */
sec.setAuthenticator(authType);
sec.setLoginService(users);
sec.setConstraintMappings(
- mappings.toArray(new ConstraintMapping[mappings.size()]));
+ mappings.toArray(new ConstraintMapping[0]));
sec.setHandler(ctx);
contexts.removeHandler(ctx);
private Map<String, LfsPointer> requestBatchUpload(HttpConnection api,
Set<LfsPointer> toPush) throws IOException {
- LfsPointer[] res = toPush.toArray(new LfsPointer[toPush.size()]);
+ LfsPointer[] res = toPush.toArray(new LfsPointer[0]);
Map<String, LfsPointer> oidStr2ptr = new HashMap<>();
for (LfsPointer p : res) {
oidStr2ptr.put(p.getOid().name(), p);
}
if (r.length() > 0)
list.add(r.toString());
- return list.toArray(new String[list.size()]);
+ return list.toArray(new String[0]);
}
public static class Result {
byte[] result = CLIGitCommand.executeRaw(
"git archive --format=zip HEAD", db).outBytes();
- assertArrayEquals(l.toArray(new String[l.size()]),
+ assertArrayEquals(l.toArray(new String[0]),
listZipEntries(result));
}
byte[] result = CLIGitCommand.executeRaw(
"git archive --format=tar HEAD", db).outBytes();
- assertArrayEquals(l.toArray(new String[l.size()]),
+ assertArrayEquals(l.toArray(new String[0]),
listTarEntries(result));
}
while ((e = in.getNextEntry()) != null)
l.add(e.getName());
}
- return l.toArray(new String[l.size()]);
+ return l.toArray(new String[0]);
}
private static Future<Object> writeAsync(OutputStream stream, byte[] data) {
while ((line = reader.readLine()) != null)
l.add(line);
- return l.toArray(new String[l.size()]);
+ return l.toArray(new String[0]);
} finally {
writing.get();
proc.destroy();
String line;
while ((line = reader.readLine()) != null)
l.add(line);
- return l.toArray(new String[l.size()]);
+ return l.toArray(new String[0]);
}
// not found
while ((line = reader.readLine()) != null)
l.add(line);
- return l.toArray(new String[l.size()]);
+ return l.toArray(new String[0]);
} finally {
writing.get();
proc.destroy();
}
private static CommandRef[] toSortedArray(Collection<CommandRef> c) {
- final CommandRef[] r = c.toArray(new CommandRef[c.size()]);
+ final CommandRef[] r = c.toArray(new CommandRef[0]);
Arrays.sort(r, new Comparator<CommandRef>() {
@Override
public int compare(CommandRef o1, CommandRef o2) {
if (tree != null)
cmd.setTarget(tree);
cmd.setLong(longDesc);
- cmd.setMatch(patterns.toArray(new String[patterns.size()]));
+ cmd.setMatch(patterns.toArray(new String[0]));
String result = null;
try {
result = cmd.call();
final TextBuiltin cmd = subcommand;
init(cmd);
try {
- cmd.execute(arguments.toArray(new String[arguments.size()]));
+ cmd.execute(arguments.toArray(new String[0]));
} finally {
if (cmd.outw != null) {
cmd.outw.flush();
fetchArgs.add(name);
}
- fetch.execute(fetchArgs.toArray(new String[fetchArgs.size()]));
+ fetch.execute(fetchArgs.toArray(new String[0]));
// flush the streams
fetch.outw.flush();
}
try {
- super.parseArgument(tmp.toArray(new String[tmp.size()]));
+ super.parseArgument(tmp.toArray(new String[0]));
} catch (Die e) {
if (!seenHelp) {
throw e;
}
private String[] getModified() {
- return modified.toArray(new String[modified.size()]);
+ return modified.toArray(new String[0]);
}
private String[] getDeleted() {
- return deleted.toArray(new String[deleted.size()]);
+ return deleted.toArray(new String[0]);
}
private void reset() {
Collection<ReflogEntry> reflog = git.reflog().call();
assertNotNull(reflog);
assertEquals(3, reflog.size());
- ReflogEntry[] reflogs = reflog.toArray(new ReflogEntry[reflog.size()]);
+ ReflogEntry[] reflogs = reflog.toArray(new ReflogEntry[0]);
assertEquals(reflogs[2].getComment(),
"commit (initial): Initial commit");
assertEquals(reflogs[2].getNewId(), commit1.getId());
.setRef(Constants.R_HEADS + "b1").call();
assertNotNull(reflog);
assertEquals(2, reflog.size());
- ReflogEntry[] reflogs = reflog.toArray(new ReflogEntry[reflog.size()]);
+ ReflogEntry[] reflogs = reflog.toArray(new ReflogEntry[0]);
assertEquals(reflogs[0].getComment(), "commit: Removed file");
assertEquals(reflogs[0].getNewId(), commit2.getId());
assertEquals(reflogs[0].getOldId(), commit1.getId());
Collection<ReflogEntry> reflog = git.reflog().call();
assertNotNull(reflog);
assertEquals(4, reflog.size());
- ReflogEntry[] reflogs = reflog.toArray(new ReflogEntry[reflog.size()]);
+ ReflogEntry[] reflogs = reflog.toArray(new ReflogEntry[0]);
assertEquals(reflogs[3].getComment(),
"commit (initial): Initial commit");
assertEquals(reflogs[3].getNewId(), commit1.getId());
}
}
- String[] e = expect.toArray(new String[expect.size()]);
- String[] a = actual.toArray(new String[actual.size()]);
+ String[] e = expect.toArray(new String[0]);
+ String[] a = actual.toArray(new String[0]);
Arrays.sort(e);
Arrays.sort(a);
assertArrayEquals(e, a);
if (!conflicts.isEmpty()) {
if (failOnConflict)
- throw new CheckoutConflictException(conflicts.toArray(new String[conflicts.size()]));
+ throw new CheckoutConflictException(conflicts.toArray(new String[0]));
else
cleanUpConflicts();
}
lock.lock();
try {
- voters = v.toArray(new KetchReplica[v.size()]);
- followers = f.toArray(new KetchReplica[f.size()]);
+ voters = v.toArray(new KetchReplica[0]);
+ followers = f.toArray(new KetchReplica[0]);
self = me;
} finally {
lock.unlock();
checkFailed(failed, accepted);
checkFailed(failed, committed);
if (!failed.isEmpty()) {
- String[] arr = failed.toArray(new String[failed.size()]);
+ String[] arr = failed.toArray(new String[0]);
req.setRefs(refdb.exactRef(arr));
}
}
LocalCachedPack(ObjectDirectory odb, List<String> packNames) {
this.odb = odb;
- this.packNames = packNames.toArray(new String[packNames.size()]);
+ this.packNames = packNames.toArray(new String[0]);
}
LocalCachedPack(List<PackFile> packs) {
odb = null;
packNames = null;
- this.packs = packs.toArray(new PackFile[packs.size()]);
+ this.packs = packs.toArray(new PackFile[0]);
}
/** {@inheritDoc} */
if (list.isEmpty())
return new PackList(snapshot, NO_PACKS.packs);
- final PackFile[] r = list.toArray(new PackFile[list.size()]);
+ final PackFile[] r = list.toArray(new PackFile[0]);
Arrays.sort(r, PackFile.SORT);
return new PackList(snapshot, r);
}
l.add(openAlternate(line));
}
}
- return l.toArray(new AlternateHandle[l.size()]);
+ return l.toArray(new AlternateHandle[0]);
}
private static BufferedReader open(File f)
List<ObjectToPack> edges, ObjectReader or) {
progress = countingMonitor;
reader = or;
- baseTrees = bases.toArray(new ObjectId[bases.size()]);
+ baseTrees = bases.toArray(new ObjectId[0]);
objectsMap = objects;
edgeObjects = edges;
final List<File> alts = alternateObjectDirectories;
if (alts == null)
return null;
- return alts.toArray(new File[alts.size()]);
+ return alts.toArray(new File[0]);
}
/**
if (list == null) {
return PlotCommit.NO_REFS;
} else {
- Ref[] tags = list.toArray(new Ref[list.size()]);
+ Ref[] tags = list.toArray(new Ref[0]);
Arrays.sort(tags, new PlotRefComparator());
return tags;
}
*/
public boolean get(URIish uri, List<CredentialItem> items)
throws UnsupportedCredentialItem {
- return get(uri, items.toArray(new CredentialItem[items.size()]));
+ return get(uri, items.toArray(new CredentialItem[0]));
}
/**
if (values == null || values.isEmpty()) {
return new String[0];
}
- return values.toArray(new String[values.size()]);
+ return values.toArray(new String[0]);
}
public void setValue(String key, String value) {
if (result.isEmpty()) {
return NO_ENTRIES;
}
- return result.toArray(new Entry[result.size()]);
+ return result.toArray(new Entry[0]);
}
/** {@inheritDoc} */