Example usage for java.util List toString

List of usage examples for java.util List toString

Introduction

In this page you can find the example usage for java.util List toString.

Prototype

public String toString() 

Source Link

Document

Returns a string representation of the object.

Usage

From source file:com.compal.wifitest.WifiTestCase.java

public void scanningTest() {
    if (mWifiManager.startScan()) {
        Log.i(tag, "AP scanning");
        long startTime = System.currentTimeMillis();
        long tempTime = startTime; //debug
        while ((System.currentTimeMillis() - startTime) < LONG_TIMEOUT * 6) {
            List<ScanResult> wifiList = mWifiManager.getScanResults();
            //debug
            if ((System.currentTimeMillis() - tempTime) > 2000) {
                Log.i(tag, wifiList.toString());
                Log.i(tag, Integer.toString(wifiList.size()));
            }//from   w w  w  . j  a  va  2s . co  m
            //debug
            if (wifiList != null && wifiList.size() != 0) {
                Log.i(tag, wifiList.toString());
                Log.i(tag, Integer.toString(wifiList.size()));
                outputResult(true, tWifiBasicFunc, dApScanning, testCaseId);
                Log.i(tag, "test_3rd_APscanning true");
                return;
            }
            sleep(100);
        }
        outputResult(false, tWifiBasicFunc, dApScanning, testCaseId);
        Log.i(tag, "test_3rd_APscanning false");
        return;
    }
}

From source file:org.geowebcache.layer.TileLayerDispatcher.java

/**
 * Eliminates the gridset from the {@link GridSetBroker} and the {@link XMLConfiguration} only
 * if no layer references the given GridSet.
 * <p>/*from w  w w.j  ava  2  s .  c  om*/
 * NOTE this method does not save the configuration, it's up to the calling code to do that in
 * order to make the change persistent.
 * </p>
 * 
 * @param gridSetName
 *            the gridset to remove.
 * @return the configuration modified after removing the gridset, or {@code null}
 * @throws IllegalStateException
 *             if there's any layer referencing the given GridSet
 * @throws IOException
 * @see {@link GridSetBroker#remove(String)}
 */
public synchronized Configuration removeGridset(final String gridSetName)
        throws IllegalStateException, IOException {

    GridSet gridSet = gridSetBroker.get(gridSetName);
    if (gridSet == null) {
        return null;
    }
    List<String> refereningLayers = new ArrayList<String>();
    for (TileLayer layer : getLayerList()) {
        GridSubset gridSubset = layer.getGridSubset(gridSetName);
        if (gridSubset != null) {
            refereningLayers.add(layer.getName());
        }
    }
    if (refereningLayers.size() > 0) {
        throw new IllegalStateException("There are TileLayers referencing gridset '" + gridSetName + "': "
                + refereningLayers.toString());
    }
    XMLConfiguration persistingConfig = getXmlConfiguration();
    GridSet removed = gridSetBroker.remove(gridSetName);
    Assert.notNull(removed != null);
    Assert.notNull(persistingConfig.removeGridset(gridSetName));

    return persistingConfig;
}

From source file:com.evozon.evoportal.my_account.validator.UserAccountValidation.java

private boolean isCNPDuplicate(ActionRequest actionRequest) {
    boolean isValid = true;
    try {// www .ja v a 2s.c o  m
        User selectedUser = PortalUtil.getSelectedUser(actionRequest);

        if (selectedUser != null) {

            String oldCNP = new UserExpandoWrapper(selectedUser).getPersonalIdentificationNumber();
            String newCNP = ParamUtil.getString(actionRequest, MyAccountConstants.USER_CNP);

            if (!oldCNP.equals(newCNP)) {
                // only if CNP was changed
                long userIdCNP = PortalUtil.getUserId(actionRequest);
                List<String> usersWithSameCNP = getUsersWithCNP(newCNP, userIdCNP);
                if (!usersWithSameCNP.isEmpty()) {
                    String errMsg = "The following users have the same CNP: " + usersWithSameCNP.toString();

                    SessionErrors.add(actionRequest, "duplicate-cnp", errMsg);
                    isValid = false;
                }

            }
        }
    } catch (PortalException e) {
        logger.error(e.getMessage(), e);
    } catch (SystemException e) {
        logger.error(e.getMessage(), e);
    }

    return isValid;
}

From source file:eu.europa.esig.dss.validation.policy.EtsiValidationPolicy.java

@Override
public Constraint getCommitmentTypeIndicationConstraint() {

    final String level = getValue(
            "/ConstraintsParameters/MainSignature/MandatedSignedQProperties/CommitmentTypeIndication/@Level");
    if (StringUtils.isNotBlank(level)) {

        final Constraint constraint = new Constraint(level);
        final List<XmlDom> commitmentTypeIndications = getElements(
                "/ConstraintsParameters/MainSignature/MandatedSignedQProperties/CommitmentTypeIndication/Identifier");
        final List<String> identifierList = XmlDom.convertToStringList(commitmentTypeIndications);
        constraint.setExpectedValue(identifierList.toString());
        constraint.setIdentifiers(identifierList);
        return constraint;
    }/*from  ww  w  .j a  v  a 2s .co m*/
    return null;
}

From source file:com.webcrawler.MailCrawlerService.java

/**
 * Gets the absolute mail urls./* w  w  w  .ja  va2 s .co m*/
 *
 * @param linkElements the link elements
 * @param searchToken the search token
 * @return the absolute mail urls
 * @throws IOException Signals that an I/O exception has occurred.
 */
private List<String> getAbsoluteMailUrls(Elements linkElements, String searchToken) throws IOException {
    List<String> absoluteURLList = new ArrayList<String>();
    List<Element> relativeURLList = new ArrayList<Element>();
    for (Element linkElement : linkElements) {
        String absouleUrl = linkElement.attr("abs:href");
        Elements anchorElements = getLinkElements(Jsoup.connect(absouleUrl).get(), "a");
        CollectionUtils.select(anchorElements, getLinkFilterPredicate(getRegexMailUrlPattern(searchToken)),
                relativeURLList);
    }
    for (Element element : relativeURLList) {
        absoluteURLList.add(element.attr("abs:href"));
    }
    if (log.isDebugEnabled()) {
        log.debug("Absolute URL List: " + absoluteURLList.toString());
    }
    return absoluteURLList;
}

From source file:com.weibo.api.motan.registry.zookeeper.ZookeeperRegistry.java

@Override
protected void subscribeService(final URL url, final ServiceListener serviceListener) {
    try {//from w w w.ja v  a 2 s. c o  m
        clientLock.lock();
        ConcurrentHashMap<ServiceListener, IZkChildListener> childChangeListeners = serviceListeners.get(url);
        if (childChangeListeners == null) {
            serviceListeners.putIfAbsent(url, new ConcurrentHashMap<ServiceListener, IZkChildListener>());
            childChangeListeners = serviceListeners.get(url);
        }
        IZkChildListener zkChildListener = childChangeListeners.get(serviceListener);
        if (zkChildListener == null) {
            childChangeListeners.putIfAbsent(serviceListener, new IZkChildListener() {
                @Override
                public void handleChildChange(String parentPath, List<String> currentChilds) {
                    serviceListener.notifyService(url, getUrl(),
                            nodeChildsToUrls(url, parentPath, currentChilds));
                    LoggerUtil.info(
                            String.format("[ZookeeperRegistry] service list change: path=%s, currentChilds=%s",
                                    parentPath, currentChilds.toString()));
                }
            });
            zkChildListener = childChangeListeners.get(serviceListener);
        }

        // 
        removeNode(url, ZkNodeType.CLIENT);
        createNode(url, ZkNodeType.CLIENT);

        String serverTypePath = ZkUtils.toNodeTypePath(url, ZkNodeType.AVAILABLE_SERVER);
        zkClient.subscribeChildChanges(serverTypePath, zkChildListener);
        LoggerUtil.info(String.format("[ZookeeperRegistry] subscribe service: path=%s, info=%s",
                ZkUtils.toNodePath(url, ZkNodeType.AVAILABLE_SERVER), url.toFullStr()));
    } catch (Throwable e) {
        throw new MotanFrameworkException(String.format("Failed to subscribe %s to zookeeper(%s), cause: %s",
                url, getUrl(), e.getMessage()), e);
    } finally {
        clientLock.unlock();
    }
}

From source file:it.baywaylabs.jumpersumo.twitter.TwitterListener.java

/**
 * This method extract ordered commands list.
 *
 * @param ai//from   www. j  av a2  s . co  m
 * @param statuses
 * @deprecated use {@link #extractCommandV2(Intelligence, List)} instead.
 */
private void extractCommand(Intelligence ai, List<twitter4j.Status> statuses) {
    publishProgress(false);

    HashMap<Integer, String> map = new HashMap<Integer, String>();
    String twText = statuses.get(0).getText().toLowerCase();

    for (String command : ai.getMoveOn()) {

        int lastIndex = 0;
        int count = 0;

        while (lastIndex != -1) {

            lastIndex = twText.indexOf(command, lastIndex);

            if (lastIndex != -1) {
                count++;
                map.put(lastIndex, "FORWARD");
                lastIndex += command.length();
            }
        }
    }
    for (String command : ai.getMoveBack()) {
        int lastIndex = 0;
        int count = 0;

        while (lastIndex != -1) {

            lastIndex = twText.indexOf(command, lastIndex);

            if (lastIndex != -1) {
                count++;
                map.put(lastIndex, "BACK");
                lastIndex += command.length();
            }
        }
    }
    for (String command : ai.getTurnLeft()) {

        int lastIndex = 0;
        int count = 0;

        while (lastIndex != -1) {

            lastIndex = twText.indexOf(command, lastIndex);

            if (lastIndex != -1) {
                count++;
                map.put(lastIndex, "LEFT");
                lastIndex += command.length();
            }
        }
    }
    for (String command : ai.getTurnRight()) {

        int lastIndex = 0;
        int count = 0;

        while (lastIndex != -1) {

            lastIndex = twText.indexOf(command, lastIndex);

            if (lastIndex != -1) {
                count++;
                map.put(lastIndex, "RIGHT");
                lastIndex += command.length();
            }
        }
    }
    for (String command : ai.getTakePhoto()) {

        int lastIndex = 0;
        int count = 0;

        while (lastIndex != -1) {

            lastIndex = twText.indexOf(command, lastIndex);

            if (lastIndex != -1) {
                count++;
                map.put(lastIndex, "PHOTO");
                lastIndex += command.length();
            }
        }
    }
    for (String command : ai.getExecuteCsv()) {

        int lastIndex = 0;
        int count = 0;

        while (lastIndex != -1) {

            lastIndex = twText.indexOf(command, lastIndex);

            if (lastIndex != -1) {
                count++;
                map.put(lastIndex, "EXECUTE");
                lastIndex += command.length();
            }
        }
    }
    Log.d(TAG, "MAP: " + map.toString());
    List<String> ordered = f.getOrderedExtractedCommands(map);
    Log.d(TAG, "Lista Ordinata: " + ordered.toString());

    execute = f.joinListCommands(ordered);
    Log.d(TAG, "LISTA FINALE: " + execute.toString());

    editor.putLong(Constants.LAST_ID_MENTIONED, statuses.get(0).getId());
    editor.apply();
}

From source file:de.alpharogroup.lang.object.CompareObjectExtensionsTest.java

@SuppressWarnings({ "rawtypes", "unchecked" })
@Test(enabled = true)//from ww w  .  ja v a2s .  c om
public void testCompareTo() throws IllegalAccessException, InvocationTargetException, NoSuchMethodException {
    final List<Person> persons = new ArrayList<>();
    final Person obelix = new Person();
    obelix.setGender(Gender.MALE);
    obelix.setName("obelix");

    final Person asterix = new Person();
    asterix.setGender(Gender.MALE);
    asterix.setName("asterix");

    final Person miraculix = new Person();
    miraculix.setGender(Gender.MALE);
    miraculix.setName("miraculix");

    final int i = CompareObjectExtensions.compareTo(asterix, obelix, "name");

    System.out.println(i);

    persons.add(obelix);
    persons.add(asterix);
    persons.add(miraculix);
    System.out.println("Unsorted Persons:");
    System.out.println(persons.toString());
    final Comparator defaultComparator = new BeanComparator("name");
    Collections.sort(persons, defaultComparator);
    System.out.println("Sorted Persons by name:");
    System.out.println(persons.toString());
    Collections.reverse(persons);
    System.out.println("Sorted Persons by name reversed:");
    System.out.println(persons.toString());
}

From source file:musite.prediction.feature.disorder.DisorderTest.java

public void extractDisorder() throws IOException {
    //        String xml = "testData/musite-test.xml";
    String xml = "H:\\Phosphorylation Study\\Soybean\\combined\\site-report.with.disorder.xml";
    ProteinsXMLReader reader = DisorderUtil.getDisorderXMLReader();
    Proteins proteins = MusiteIOUtil.read(reader, xml);
    List<Double> list = new ArrayList<Double>();
    PTM ptm = PTM.PHOSPHORYLATION;/*from   w  w  w . java  2  s  . com*/
    Set<AminoAcid> aas = EnumSet.of(AminoAcid.SERINE, AminoAcid.THREONINE);
    //        Set<AminoAcid> aas = EnumSet.of(AminoAcid.TYROSINE);
    Iterator<Protein> it = proteins.proteinIterator();
    while (it.hasNext()) {
        Protein protein = it.next();
        List<Double> dis = DisorderUtil.extractDisorder(protein, ptm, aas);
        if (dis != null)
            list.addAll(dis);
    }
    System.out.println(list.toString());
}

From source file:com.bmc.gibraltar.automation.dataprovider.RestDataProvider.java

private List<String> getListOfFields(String record, String propertyName, String expectedPropertyValue) {
    String response = getRecFields(record);
    List<String> output = JsonPath.from(response).getList(
            "fieldDefinitions.findAll { it." + propertyName + " == '" + expectedPropertyValue + "'}.name");
    LOG.info("\n Record Definition '" + record + "'  has such fields :" + output.toString() + " that have "
            + propertyName + " with '" + expectedPropertyValue + "' value.");
    return output;
}