Skip to content

Latest commit

 

History

History
22 lines (16 loc) · 485 Bytes

File metadata and controls

22 lines (16 loc) · 485 Bytes

noLong

Given a list of strings, return a list of the strings, omitting any string length 4 or more.

noLong(["this", "not", "too", "long"]) → ["not", "too"]
noLong(["a", "bbb", "cccc"]) → ["a", "bbb"]
noLong(["cccc", "cccc", "cccc"]) → []

Solution:

public List<String> noLong(List<String> strings) {
  strings.removeIf(s -> s.length() >= 4);
  return strings;
}

codingbat

< back to readme