Java Queue Usage asString(Queue values)

Here you can find the source of asString(Queue values)

Description

as String

License

Apache License

Declaration

private static String asString(Queue<byte[]> values) 

Method Source Code

//package com.java2s;
/*//from   ww w .  j  a v a  2  s.  co  m
 * Copyright (c) 2013 Ramon Servadei 
 *  
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *    http://www.apache.org/licenses/LICENSE-2.0
 *    
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

import java.util.Queue;

public class Main {
    private static String asString(Queue<byte[]> values) {
        StringBuilder sb = new StringBuilder();
        sb.append("[");
        boolean first = true;
        for (byte[] bs : values) {
            if (first) {
                first = false;
            } else {
                sb.append(", ");
            }
            sb.append(bs.length).append(" bytes");
        }
        sb.append("]");
        return sb.toString();
    }
}

Related

  1. addElementsToQueueInSingleThread(int numberOfElements, Queue queue, int element)
  2. addStringArraytoQueue(Queue set, String[] array)
  3. bQToString(Queue bQ)
  4. convertQueueToArray(Queue q)
  5. elementFail(Queue q)
  6. get(Queue queue, int index)

  7. HOME | Copyright © www.java2s.com 2016