@Test public void toSnakeName() { JavaName name = JavaName.of("OneTwoThreeFour"); assertThat(name.toSnakeName(), is("one_two_three_four")); }
public String toSnakeName() { if (words.isEmpty()) { return EMPTY_NAME; } StringBuilder buf = new StringBuilder(); buf.append(words.get(0)); for (int i = 1, n = words.size(); i < n; i++) { buf.append('_'); buf.append(words.get(i)); } return buf.toString(); }
JavaName { public String toSnakeName() { if (words.isEmpty()) { return EMPTY_NAME; } StringBuilder buf = new StringBuilder(); buf.append(words.get(0)); for (int i = 1, n = words.size(); i < n; i++) { buf.append('_'); buf.append(words.get(i)); } return buf.toString(); } }
JavaName { public String toSnakeName() { if (words.isEmpty()) { return EMPTY_NAME; } StringBuilder buf = new StringBuilder(); buf.append(words.get(0)); for (int i = 1, n = words.size(); i < n; i++) { buf.append('_'); buf.append(words.get(i)); } return buf.toString(); } JavaName(List<String> words); }
JavaName { public String toSnakeName() { if (words.isEmpty()) { return EMPTY_NAME; } StringBuilder buf = new StringBuilder(); buf.append(words.get(0)); for (int i = 1, n = words.size(); i < n; i++) { buf.append('_'); buf.append(words.get(i)); } return buf.toString(); } JavaName(List<String> words); static JavaName of(String nameString); List<String> getSegments(); String toTypeName(); String toMemberName(); String toConstantName(); String toSnakeName(); void addFirst(String segment); void removeFirst(); void addLast(String segment); void removeLast(); }
JavaName { public String toSnakeName() { if (words.isEmpty()) { return EMPTY_NAME; } StringBuilder buf = new StringBuilder(); buf.append(words.get(0)); for (int i = 1, n = words.size(); i < n; i++) { buf.append('_'); buf.append(words.get(i)); } return buf.toString(); } JavaName(List<String> words); static JavaName of(String nameString); List<String> getSegments(); String toTypeName(); String toMemberName(); String toConstantName(); String toSnakeName(); void addFirst(String segment); void removeFirst(); void addLast(String segment); void removeLast();  }