逗号分隔的java中的数字列表

时间:2017-06-13 10:05:10

标签: java

我根据逗号分隔的集合给出了界面..我需要实现..

我未能提出解决方案

 import java.util.Collection;
 /**
  * Implement this Interface to produce a comma delimited list of numbers,
  * grouping the numbers into a range when they are sequential.
  *
  *
  * Sample Input: "1,2,6,7,8,9,12,13,14,15,21,22,23,24,25,31
  * Result: "[[1],[2], [6,7,8], [13,14,15], [21-25], [32]]"
  *
  */
  public interface CommaDelimatedList {
      public Collection<Integer> coll(String input);
      public String summarizeColl(Collection<Integer> input);

  }

有人可以帮我解决如何实现这个界面的问题..

0 个答案:

没有答案