@Override public String toString() { return Iterables.toString(this); } };
@Override public String toString() { return Iterables.toString(this); } }
/** * Returns a string representation of this fluent iterable, with the format {@code [e1, e2, ..., * en]}. * * <p><b>{@code Stream} equivalent:</b> {@code stream.collect(Collectors.joining(", ", "[", "]"))} * or (less efficiently) {@code stream.collect(Collectors.toList()).toString()}. */ @Override public String toString() { return Iterables.toString(getDelegate()); }
@Override public String toString() { return String.format("Delete the following files at %s: %s", this.fsUri, Iterables.toString(Iterables.transform(this.pathsToDelete, new Function<FileStatus, Path>() { @Nullable @Override public Path apply(@Nullable FileStatus input) { return input != null ? input.getPath() : null; } }))); } }
/** * Returns a string representation of this fluent iterable, with the format {@code [e1, e2, ..., * en]}. * * <p><b>{@code Stream} equivalent:</b> {@code stream.collect(Collectors.joining(", ", "[", "]"))} * or (less efficiently) {@code stream.collect(Collectors.toList()).toString()}. */ @Override public String toString() { return Iterables.toString(getDelegate()); }
@Override public String toString() { return Iterables.toString(asIterable()); }
@GET @Path("/{serverName}/segments") @Produces(MediaType.APPLICATION_JSON) public Response getServerSegments(@PathParam("serverName") String serverName, @QueryParam("full") String full) { Response.ResponseBuilder builder = Response.status(Response.Status.OK); DruidServer server = serverInventoryView.getInventoryValue(serverName); if (server == null) { return Response.status(Response.Status.NOT_FOUND).build(); } if (full != null) { return builder.entity(Iterables.toString(server.getSegments())).build(); } return builder .entity(Iterables.toString(Iterables.transform(server.getSegments(), DataSegment::getId))) .build(); }
/** * Returns a string representation of this fluent iterable, with the format {@code [e1, e2, ..., * en]}. * * <p><b>{@code Stream} equivalent:</b> {@code stream.collect(Collectors.joining(", ", "[", "]"))} * or (less efficiently) {@code stream.collect(Collectors.toList()).toString()}. */ @Override public String toString() { return Iterables.toString(getDelegate()); }
public Builder<K, V> putAll(K key, Iterable<? extends V> values) { if (key == null) { throw new NullPointerException("null key in entry: null=" + Iterables.toString(values));
@Override public String toString() { return new StringJoiner(", ", this.getClass().getSimpleName() + "{", "}") .add("timestamp=" + timestamp()) .add("name=" + name()) .add("description=" + description()) .add("tags=" + tags()) .add("metrics=" + Iterables.toString(metrics())) .toString(); } }
public Builder<K, V> putAll(K key, Iterable<? extends V> values) { if (key == null) { throw new NullPointerException("null key in entry: null=" + Iterables.toString(values));
private final String formatActualOrExpected(@NullableDecl Object o) { if (o instanceof byte[]) { return base16((byte[]) o); } else if (o != null && o.getClass().isArray()) { String wrapped = Iterables.toString(stringableIterable(new Object[] {o})); return wrapped.substring(1, wrapped.length() - 1); } else if (o instanceof Double) { return doubleToString((Double) o); } else if (o instanceof Float) { return floatToString((Float) o); } else { return String.valueOf(o); } }
@Override protected String actualCustomStringRepresentation() { if (actual() != null) { // Check the value of iterable.toString() against the default Object.toString() implementation // so we can avoid things like "com.google.common.graph.Traverser$GraphTraverser$1@5e316c74" String objectToString = actual().getClass().getName() + '@' + Integer.toHexString(System.identityHashCode(actual())); if (actual().toString().equals(objectToString)) { return Iterables.toString(actual()); } } return super.actualCustomStringRepresentation(); }
@SuppressWarnings("unchecked") @Test public void cogroup() { JavaPairRDD<String, String> categories = sc.parallelizePairs(Arrays.asList( new Tuple2<>("Apples", "Fruit"), new Tuple2<>("Oranges", "Fruit"), new Tuple2<>("Oranges", "Citrus") )); JavaPairRDD<String, Integer> prices = sc.parallelizePairs(Arrays.asList( new Tuple2<>("Oranges", 2), new Tuple2<>("Apples", 3) )); JavaPairRDD<String, Tuple2<Iterable<String>, Iterable<Integer>>> cogrouped = categories.cogroup(prices); assertEquals("[Fruit, Citrus]", Iterables.toString(cogrouped.lookup("Oranges").get(0)._1())); assertEquals("[2]", Iterables.toString(cogrouped.lookup("Oranges").get(0)._2())); cogrouped.collect(); }
@SuppressWarnings("unchecked") @Test public void cogroup() { JavaPairRDD<String, String> categories = sc.parallelizePairs(Arrays.asList( new Tuple2<>("Apples", "Fruit"), new Tuple2<>("Oranges", "Fruit"), new Tuple2<>("Oranges", "Citrus") )); JavaPairRDD<String, Integer> prices = sc.parallelizePairs(Arrays.asList( new Tuple2<>("Oranges", 2), new Tuple2<>("Apples", 3) )); JavaPairRDD<String, Tuple2<Iterable<String>, Iterable<Integer>>> cogrouped = categories.cogroup(prices); assertEquals("[Fruit, Citrus]", Iterables.toString(cogrouped.lookup("Oranges").get(0)._1())); assertEquals("[2]", Iterables.toString(cogrouped.lookup("Oranges").get(0)._2())); cogrouped.collect(); }
@SuppressWarnings("unchecked") @Test public void cogroup() { JavaPairRDD<String, String> categories = sc.parallelizePairs(Arrays.asList( new Tuple2<>("Apples", "Fruit"), new Tuple2<>("Oranges", "Fruit"), new Tuple2<>("Oranges", "Citrus") )); JavaPairRDD<String, Integer> prices = sc.parallelizePairs(Arrays.asList( new Tuple2<>("Oranges", 2), new Tuple2<>("Apples", 3) )); JavaPairRDD<String, Tuple2<Iterable<String>, Iterable<Integer>>> cogrouped = categories.cogroup(prices); assertEquals("[Fruit, Citrus]", Iterables.toString(cogrouped.lookup("Oranges").get(0)._1())); assertEquals("[2]", Iterables.toString(cogrouped.lookup("Oranges").get(0)._2())); cogrouped.collect(); }
@SuppressWarnings("unchecked") @Test public void cogroup3() { JavaPairRDD<String, String> categories = sc.parallelizePairs(Arrays.asList( new Tuple2<>("Apples", "Fruit"), new Tuple2<>("Oranges", "Fruit"), new Tuple2<>("Oranges", "Citrus") )); JavaPairRDD<String, Integer> prices = sc.parallelizePairs(Arrays.asList( new Tuple2<>("Oranges", 2), new Tuple2<>("Apples", 3) )); JavaPairRDD<String, Integer> quantities = sc.parallelizePairs(Arrays.asList( new Tuple2<>("Oranges", 21), new Tuple2<>("Apples", 42) )); JavaPairRDD<String, Tuple3<Iterable<String>, Iterable<Integer>, Iterable<Integer>>> cogrouped = categories.cogroup(prices, quantities); assertEquals("[Fruit, Citrus]", Iterables.toString(cogrouped.lookup("Oranges").get(0)._1())); assertEquals("[2]", Iterables.toString(cogrouped.lookup("Oranges").get(0)._2())); assertEquals("[42]", Iterables.toString(cogrouped.lookup("Apples").get(0)._3())); cogrouped.collect(); }
@SuppressWarnings("unchecked") @Test public void cogroup3() { JavaPairRDD<String, String> categories = sc.parallelizePairs(Arrays.asList( new Tuple2<>("Apples", "Fruit"), new Tuple2<>("Oranges", "Fruit"), new Tuple2<>("Oranges", "Citrus") )); JavaPairRDD<String, Integer> prices = sc.parallelizePairs(Arrays.asList( new Tuple2<>("Oranges", 2), new Tuple2<>("Apples", 3) )); JavaPairRDD<String, Integer> quantities = sc.parallelizePairs(Arrays.asList( new Tuple2<>("Oranges", 21), new Tuple2<>("Apples", 42) )); JavaPairRDD<String, Tuple3<Iterable<String>, Iterable<Integer>, Iterable<Integer>>> cogrouped = categories.cogroup(prices, quantities); assertEquals("[Fruit, Citrus]", Iterables.toString(cogrouped.lookup("Oranges").get(0)._1())); assertEquals("[2]", Iterables.toString(cogrouped.lookup("Oranges").get(0)._2())); assertEquals("[42]", Iterables.toString(cogrouped.lookup("Apples").get(0)._3())); cogrouped.collect(); }
@SuppressWarnings("unchecked") @Test public void cogroup3() { JavaPairRDD<String, String> categories = sc.parallelizePairs(Arrays.asList( new Tuple2<>("Apples", "Fruit"), new Tuple2<>("Oranges", "Fruit"), new Tuple2<>("Oranges", "Citrus") )); JavaPairRDD<String, Integer> prices = sc.parallelizePairs(Arrays.asList( new Tuple2<>("Oranges", 2), new Tuple2<>("Apples", 3) )); JavaPairRDD<String, Integer> quantities = sc.parallelizePairs(Arrays.asList( new Tuple2<>("Oranges", 21), new Tuple2<>("Apples", 42) )); JavaPairRDD<String, Tuple3<Iterable<String>, Iterable<Integer>, Iterable<Integer>>> cogrouped = categories.cogroup(prices, quantities); assertEquals("[Fruit, Citrus]", Iterables.toString(cogrouped.lookup("Oranges").get(0)._1())); assertEquals("[2]", Iterables.toString(cogrouped.lookup("Oranges").get(0)._2())); assertEquals("[42]", Iterables.toString(cogrouped.lookup("Apples").get(0)._3())); cogrouped.collect(); }