Here you can find the source of joinSequence(Collection
Parameter | Description |
---|---|
sequence | a parameter |
public static String joinSequence(Collection<Long> sequence)
//package com.java2s; /******************************************************************************* * Copyright (c) 2009 the CHISEL group and contributors. All rights reserved. * This program and the accompanying materials are made available under the * terms of the Eclipse Public License v1.0 which accompanies this distribution, * and is available at http://www.eclipse.org/legal/epl-v10.html * /*from w w w .j ava 2 s . c om*/ * Contributors: the CHISEL group - initial API and implementation *******************************************************************************/ import java.util.Collection; public class Main { /** * Joins the list of numbers as a dot-separated string. * @param sequence * @return */ public static String joinSequence(Collection<Long> sequence) { if (sequence == null) { return null; } StringBuilder builder = new StringBuilder(); int i = 0; for (long l : sequence) { builder.append(l); i++; if (i < sequence.size()) { builder.append('.'); } } return builder.toString(); } }