Guava Joiner - top ranked examples from Open Source projects

These code examples were ranked by Codota’s semantic indexing as the best open source examples for Guava Joiner class.

This code example shows how to use the following methods:join
public class TestZookeeperLockManager { 
 
  private static final Joiner SLASH = Joiner.on("/");
  private static final String PARENT = "hive";
  private static final String TABLE = "t1";
  private static final String PARENT_LOCK_PATH = SLASH.join("", PARENT, TABLE);
  private static final String TABLE_LOCK_PATH =  SLASH.join("", PARENT, TABLE, "00001");
  private HiveConf conf;
  private ZooKeeper zooKeeper;
  private HiveLockObject hiveLock;
  private ZooKeeperHiveLock zLock;
 
  @Before 
  public void setup() { 
    conf = new HiveConf();
    zooKeeper = mock(ZooKeeper.class);
    hiveLock = mock(HiveLockObject.class);
    when(hiveLock.getName()).thenReturn(TABLE);
    zLock = new ZooKeeperHiveLock(TABLE_LOCK_PATH, hiveLock, HiveLockMode.SHARED);
  } 
5
CodeRank
Connect your IDE to all the code out there  Get Codota for Java
This code example shows how to use the following methods:join
      return (int) (-mean * Math.log1p(-RAND.nextDouble()));
    } 
 
    @Override 
    public String toString() {
      return WITH_COMMAS.join(data);
    } 
 
    public String get(int field) {
      return data.get(field);
    } 
  } 
 
  private static final class FastLine { 
 
    private final ByteBuffer base;
    private final IntArrayList start = new IntArrayList();
    private final IntArrayList length = new IntArrayList();
 
    private FastLine(ByteBuffer base) {
5
CodeRank
Connect your IDE to all the code out there  Get Codota for Java
This code example shows how to use the following methods:join
          @Override 
          public String apply(Class<?> from) {
            return from.getSimpleName();
          } 
    }); 
    return methodName + "(" + COMMA_JOINER.join(parameterNames) + ")";
  } 
   
  private static Object getDefaultValue(Class<?> returnType) {
    if (returnType == boolean.class || returnType == Boolean.class) {
      return Boolean.FALSE;
    } else if (returnType == int.class || returnType == Integer.class) {
      return 0; 
    } else if ((returnType == Set.class) || (returnType == Collection.class)) {
      return Collections.emptySet();
    } else if (returnType == Iterator.class){
      return Iterators.emptyModifiableIterator();
    } else if (returnType.isArray()) {
      return Array.newInstance(returnType.getComponentType(), 0);
    } else { 
4
CodeRank
Connect your IDE to all the code out there  Get Codota for Java
This code example shows how to use the following methods:join
    public String getStringValue() {
        if (mCurrentValue == null) { 
            return "null"; 
        } else { 
            if (mCurrentValue instanceof List<?>) {
                return "[" + JOINER.join((List<?>) mCurrentValue) + "]"; //$NON-NLS-1$ //$NON-NLS-2$
            } 
            return mCurrentValue.toString(); 
        } 
    } 
 
    @Override 
    public String toString() {
        return getType() + "=" + getStringValue(); //$NON-NLS-1$ 
    } 
 
    @Override 
    public Object getValue() { 
        return mCurrentValue; 
    } 
5
CodeRank
Connect your IDE to all the code out there  Get Codota for Java
This code example shows how to use the following methods:join
          @Override 
          public String apply(Class<?> from) {
            return from.getSimpleName();
          } 
    }); 
    return methodName + "(" + COMMA_JOINER.join(parameterNames) + ")";
  } 
   
  private static Object getDefaultValue(Class<?> returnType) {
    if (returnType == boolean.class || returnType == Boolean.class) {
      return Boolean.FALSE;
    } else if (returnType == int.class || returnType == Integer.class) {
      return 0; 
    } else if ((returnType == Set.class) || (returnType == Collection.class)) {
      return Collections.emptySet();
    } else if (returnType == Iterator.class){
      return Iterators.emptyModifiableIterator();
    } else if (returnType.isArray()) {
      return Array.newInstance(returnType.getComponentType(), 0);
    } else { 
4
CodeRank
Connect your IDE to all the code out there  Get Codota for Java
This code example shows how to use the following methods:join
        } 
 
        public static void header(Format format, List<String> names, PrintStream out) {
            switch (format) {
                case TSV:
                    out.printf("%s\n", withTabs.join(names));
                    break; 
                case CSV:
                    out.printf("%s\n", withCommas.join(names));
                    break; 
            } 
        } 
 
        public static int generateFile(Options opts, SchemaSampler s, PrintStream out, int count) {
            for (int i = 0; i < count; i++) {
                format(opts.format, opts.quote, s.getFieldNames(), s.sample(), out);
            } 
            return count;
        } 
 
3
CodeRank
Connect your IDE to all the code out there  Get Codota for Java
This code example shows how to use the following methods:join
            @Override 
            public String apply(String s) {
                return "\\b" + s + "\\b";
            } 
        }); 
        return Pattern.compile("(" + patternPrefix + PipeJoiner.join(tokensAsWords) + ")");
    } 
} 
4
CodeRank
Connect your IDE to all the code out there  Get Codota for Java
This code example shows how to use the following methods:join
 
        // lines: ["61 62 63", ...] 
        Iterable<String> lines = transform(hexLines, joinerFunction(HEX_BYTE_JOINER));
 
        // joined: "61 62 63\n..." 
        return HEX_LINE_JOINER.join(lines);
    } 
 
    private static Function<Iterable<String>, String> joinerFunction(final Joiner joiner)
    { 
        return new Function<Iterable<String>, String>()
        { 
            @Override 
            public String apply(Iterable<String> iterable)
            { 
                return joiner.join(iterable);
            } 
        }; 
    } 
 
3
CodeRank
Connect your IDE to all the code out there  Get Codota for Java
This code example shows how to use the following methods:join
 
  @Override 
  public String convertToPresentation(TreeSet value,
    Class<? extends String> targetType, Locale locale) throws ConversionException
  { 
    return joiner.join(value);
  } 
 
  @Override 
  public Class<String> getPresentationType()
  { 
    return String.class;
  } 
 
  @Override 
  public Class<TreeSet> getModelType()
  { 
    return TreeSet.class;
  } 
   
4
CodeRank
Connect your IDE to all the code out there  Get Codota for Java
This code example shows how to use the following methods:join
        TranslatorUtils.from(dbo, VERSION_KEY, version);
        scheduleVersions.save(dbo);
    } 
     
    private String idFor(Channel channel, LocalDate scheduleDay) {
        return joiner.join(channel.getKey(), scheduleDay.toString());
    } 
} 
5
CodeRank
Connect your IDE to all the code out there  Get Codota for Java
See Code Examples for Guava Joiner Methods: