Пример #1
0
		private static string[] finishSplit(java.util.List<string> list, string input, int
			 begin, int maxSize, int limit)
		{
			// Add trailing text.
			if (begin < input.Length)
			{
				list.add(Sharpen.StringHelper.Substring(input, begin));
			}
			else
			{
				if (limit != 0)
				{
					// No point adding the empty string if limit == 0, just to remove it below.
					list.add(string.Empty);
				}
			}
			// Remove all trailing empty matches in the limit == 0 case.
			if (limit == 0)
			{
				int i = list.size() - 1;
				while (i >= 0 && string.IsNullOrEmpty(list.get(i)))
				{
					list.remove(i);
					i--;
				}
			}
			// Convert to an array.
			return list.toArray(new string[list.size()]);
		}
Пример #2
0
 public void row(java.util.List cells, int line)
 {
     if (this.isInExample)
     {
         this.scenarioOutlineBuilder.SetExampleTableRow(cells.toArray().Select(cell => cell.ToString()).ToList());
     }
     else
     {
         this.stepBuilder.AddTableRow(cells.toArray().Select(cell => cell.ToString()).ToList());
     }
 }
 /**
  * Gets a comparator that compares using a collection of {@link Comparator}s,
  * applied in (default iterator) sequence until one returns not equal or the
  * collection is exhausted.
  *
  * @param comparators  the comparators to use, not null or empty or containing nulls
  * @return a {@link ComparatorChain} formed from the input comparators
  * @throws NullPointerException if comparators collection is null or contains a null
  * @throws ClassCastException if the comparators collection contains the wrong object type
  * @see ComparatorChain
  */
 public static java.util.Comparator<Object> chainedComparator(java.util.Collection<Object> comparators)
 {
     return chainedComparator(
         (java.util.Comparator<Object>[])comparators.toArray(new java.util.Comparator<Object>[comparators.size()])
     );
 }