List of usage examples for com.google.common.primitives Longs asList
public static List<Long> asList(long... backingArray)
From source file:co.cask.tephra.distributed.TransactionConverterUtils.java
public static TTransaction wrap(Transaction tx) { return new TTransaction(tx.getTransactionId(), tx.getReadPointer(), Longs.asList(tx.getInvalids()), Longs.asList(tx.getInProgress()), tx.getFirstShortInProgress(), getTTransactionType(tx.getType()), tx.getWritePointer(), Longs.asList(tx.getCheckpointWritePointers()), getTVisibilityLevel(tx.getVisibilityLevel())); }
From source file:teetime.examples.wordcounter.WordCounterTestWithGlobalTaskPool.java
public static void writeTimingsToFile(final File outputFile, final long[] timings) throws UnsupportedEncodingException, FileNotFoundException { final PrintStream ps = new PrintStream( new BufferedOutputStream(new FileOutputStream(outputFile, true), 8192 * 8), false, "UTF-8"); try {// www .j ava2s. co m final Joiner joiner = com.google.common.base.Joiner.on(' '); final String timingsString = joiner.join(Longs.asList(timings)); ps.println(timingsString); } finally { ps.close(); } }
From source file:org.immutables.check.Checkers.java
public static IterableChecker<List<Long>, Long> check(long[] actualLongArray) { return check(Longs.asList(actualLongArray)); }
From source file:org.voltcore.agreement.matcher.SiteFailureMatchers.java
static public final Matcher<SiteFailureMessage> siteFailureIs(final Donor<List<Pair<Long, Long>>> safeTxns, final long... survivors) { final Map<Long, Long> safeTxnIds = Maps.newHashMap(); for (Pair<Long, Long> sp : safeTxns.value()) { safeTxnIds.put(sp.getFirst(), sp.getSecond()); }/*ww w.j a v a2 s. c o m*/ final Set<Long> survivorSet = ImmutableSet.copyOf(Longs.asList(survivors)); return new TypeSafeMatcher<SiteFailureMessage>() { @Override public void describeTo(Description d) { d.appendText("SiteFailureMessage [").appendText("survivors: ") .appendValueList("", ", ", "", Longs.asList(survivors)).appendText("safeTxnIds: ") .appendValue(safeTxnIds).appendText("]"); } @Override protected boolean matchesSafely(SiteFailureMessage m) { return equalTo(survivorSet).matches(m.m_survivors) && equalTo(safeTxnIds).matches(m.m_safeTxnIds); } }; }
From source file:org.truth0.subjects.PrimitiveLongArraySubject.java
@Override protected List<Long> listRepresentation() { return Longs.asList(getSubject()); }
From source file:ro.cosu.vampires.server.values.jobs.metrics.HistogramSnapshot.java
public static HistogramSnapshot fromHistogram(String name, Histogram histogram) { final Snapshot snapshot = histogram.getSnapshot(); return builder().name(name).count(histogram.getCount()).max(snapshot.getMax()).min(snapshot.getMin()) .mean(snapshot.getMean()).p50(snapshot.getMedian()).p75(snapshot.get75thPercentile()) .p95(snapshot.get95thPercentile()).p98(snapshot.get98thPercentile()) .p99(snapshot.get99thPercentile()).p999(snapshot.get999thPercentile()).stddev(snapshot.getStdDev()) .values(ImmutableList.copyOf(Longs.asList(snapshot.getValues()))).build(); }
From source file:com.b2international.commons.collections.LongArrayTransformedToSet.java
@Override public Iterator<String> iterator() { return Iterators.transform(Longs.asList(elements).iterator(), Functions.toStringFunction()); }
From source file:org.truth0.subjects.PrimitiveLongArraySubject.java
/** * A proposition that the provided Object[] is an array of the same length and type, and * contains elements such that each element in {@code expected} is equal to each element * in the subject, and in the same position. *///from w ww . j a va 2 s . c om @Override public void isEqualTo(Object expected) { long[] actual = getSubject(); if (actual == expected) { return; // short-cut. } try { long[] expectedArray = (long[]) expected; if (!Arrays.equals(actual, expectedArray)) { fail("is equal to", Longs.asList(expectedArray)); } } catch (ClassCastException e) { failWithBadType(expected); } }
From source file:de.brands4friends.daleq.core.TableBuilder.java
@Override public Table withSomeRows(final long... ids) { return withSomeRows(Longs.asList(ids)); }
From source file:org.jclouds.gogrid.binders.BindIdsToQueryParams.java
/** * Binds the ids to query parameters. The pattern, as specified by GoGrid's specification, is: * // w w w . jav a 2s . co m * https://api.gogrid.com/api/grid/server/get ?id=5153 &id=3232 * * @param request * request where the query params will be set * @param input * array of String params */ @SuppressWarnings("unchecked") @Override public <R extends HttpRequest> R bindToRequest(R request, Object input) { if (checkNotNull(input, "input is null") instanceof Long[]) { Long[] names = (Long[]) input; return (R) request.toBuilder() .replaceQueryParam(ID_KEY, transform(ImmutableList.copyOf(names), toStringFunction())).build(); } else if (input instanceof long[]) { long[] names = (long[]) input; return (R) request.toBuilder() .replaceQueryParam(ID_KEY, transform(Longs.asList(names), toStringFunction())).build(); } else { throw new IllegalArgumentException( "this binder is only valid for Long[] arguments: " + input.getClass()); } }