Example usage for java.util List equals

List of usage examples for java.util List equals

Introduction

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

Prototype

boolean equals(Object o);

Source Link

Document

Compares the specified object with this list for equality.

Usage

From source file:org.apache.syncope.client.console.widgets.JobWidget.java

public JobWidget(final String id, final PageReference pageRef) {
    super(id);/*from  w  ww  .j  a v a2  s  . c  om*/
    setOutputMarkupId(true);
    add(modal);
    modal.setWindowClosedCallback(new ModalWindow.WindowClosedCallback() {

        private static final long serialVersionUID = 8804221891699487139L;

        @Override
        public void onClose(final AjaxRequestTarget target) {
            modal.show(false);
        }
    });

    add(detailModal);
    detailModal.setWindowClosedCallback(new ModalWindow.WindowClosedCallback() {

        private static final long serialVersionUID = 8804221891699487139L;

        @Override
        public void onClose(final AjaxRequestTarget target) {
            detailModal.show(false);
        }
    });

    add(reportModal);
    reportModal.setWindowClosedCallback(new ModalWindow.WindowClosedCallback() {

        private static final long serialVersionUID = 8804221891699487139L;

        @Override
        public void onClose(final AjaxRequestTarget target) {
            reportModal.show(false);
        }
    });

    reportModal.size(Modal.Size.Large);

    available = getUpdatedAvailable();
    recent = getUpdatedRecent();

    container = new WebMarkupContainer("jobContainer");
    container.add(new IndicatorAjaxTimerBehavior(Duration.seconds(10)) {

        private static final long serialVersionUID = 7298597675929755960L;

        @Override
        protected void onTimer(final AjaxRequestTarget target) {
            List<JobTO> updatedAvailable = getUpdatedAvailable();
            if (!updatedAvailable.equals(available)) {
                available.clear();
                available.addAll(updatedAvailable);
                if (availableJobsPanel != null) {
                    availableJobsPanel.modelChanged();
                    target.add(availableJobsPanel);
                }
            }

            List<ExecTO> updatedRecent = getUpdatedRecent();
            if (!updatedRecent.equals(recent)) {
                recent.clear();
                recent.addAll(updatedRecent);
                if (recentExecPanel != null) {
                    recentExecPanel.modelChanged();
                    target.add(recentExecPanel);
                }
            }
        }
    });
    add(container);

    container.add(new AjaxBootstrapTabbedPanel<>("tabbedPanel", buildTabList(pageRef)));

    actionTogglePanel = new ActionLinksTogglePanel<>("actionTogglePanel", pageRef);
    add(actionTogglePanel);
}

From source file:org.mariotaku.twidere.adapter.ParcelableStatusesAdapter.java

@Override
public boolean setData(List<ParcelableStatus> data) {
    boolean changed = true;
    if (data instanceof ObjectCursor || data == null || data.isEmpty()) {
        mLastItemFiltered = false;/*from   w ww .  ja va 2  s  . c o m*/
    } else {
        mLastItemFiltered = data.get(data.size() - 1).is_filtered;
        changed = !data.equals(mData);
    }
    mData = data;
    notifyDataSetChanged();
    return changed;
}

From source file:org.openhie.openempi.openpixpdqadapter.PixManagerAdapter.java

public List<List<PatientIdentifier>> mergePatients(Patient patientMain, Patient otherPatient,
        MessageHeader header) throws PixManagerException {
    List<List<PatientIdentifier>> ret = new ArrayList<List<PatientIdentifier>>();

    //1. Find the old matching of mergePatient
    PatientIdentifier mainPatientId = patientMain.getPatientIds().get(0);
    PatientIdentifier otherPatientId = otherPatient.getPatientIds().get(0);
    List<PatientIdentifier> oldMrgMatching = findPatientIds(mainPatientId, header);

    //2. Merge Patients
    try {/*from  w  ww  .ja  v  a  2 s .  c  o  m*/
        Context.getPersonManagerService().mergePersons(ConversionHelper.getPersonIdentifier(otherPatientId),
                ConversionHelper.getPersonIdentifier(mainPatientId));
    } catch (Exception e) {
        throw new PixManagerException(e);
    }

    //3. Find lists of patients to be updated
    List<PatientIdentifier> newMatching = findPatientIds(mainPatientId, header);
    List<PatientIdentifier> unmatching = new ArrayList<PatientIdentifier>();
    for (PatientIdentifier oldMrg : oldMrgMatching) {
        if (!newMatching.contains(oldMrg)) {
            unmatching.add(oldMrg);
        }
    }

    //4.PIX Update Notification to PIX consumers               
    //If there is any update on the matching
    if (!newMatching.equals(oldMrgMatching)) {
        //Add the original patient id since findPatientIds 
        //does not include the original patient id.
        newMatching.add(mainPatientId);
        ret.add(newMatching);
    }
    if (unmatching.size() > 0) {
        ret.add(unmatching);
    }
    return ret;
}

From source file:org.intermine.bio.webservice.GAFQueryService.java

/**
 * Return the query specified in the request, shorn of all duplicate
 * classes in the view. Note, it is the users responsibility to ensure
 * that there are only SequenceFeatures in the view.
 * @return A suitable pathquery for getting GFF3 data from.
 *///from w ww.ja  v a  2  s.co m
protected PathQuery getQuery() {
    String xml = request.getParameter(XML_PARAM);

    if (StringUtils.isEmpty(xml)) {
        throw new BadRequestException("query is blank");
    }

    PathQueryBuilder builder = getQueryBuilder(xml);
    PathQuery pq = builder.getQuery();

    List<String> newView = new ArrayList<String>();
    Set<ClassDescriptor> seenTypes = new HashSet<ClassDescriptor>();

    for (String viewPath : pq.getView()) {
        Path p;
        try {
            p = new Path(pq.getModel(), viewPath);
        } catch (PathException e) {
            throw new BadRequestException("Query is invalid", e);
        }
        ClassDescriptor cd = p.getLastClassDescriptor();
        if (!seenTypes.contains(cd)) {
            newView.add(viewPath);
        }
        seenTypes.add(cd);
    }
    if (!newView.equals(pq.getView())) {
        pq.clearView();
        pq.addViews(newView);
    }

    return pq;
}

From source file:acromusashi.kafka.log.producer.WinApacheLogProducer.java

/**
 * tail??//  w  ww  . j  a va  2  s.  c  o  m
 *
 * @param targetPath ?
 */
public void tailRun(File targetPath) {
    try (WatchService watcher = FileSystems.getDefault().newWatchService()) {
        Path targetDir = targetPath.toPath();
        targetDir.register(watcher, ENTRY_MODIFY);
        targetDir.relativize(targetPath.toPath());
        List<String> targetFileNames = getTargetLogFiles(Lists.newArrayList(targetDir.toFile().list()));
        Collections.sort(targetFileNames);
        int logFileNameSize = targetFileNames.size();
        this.targetFile = new File(targetDir + "/" + targetFileNames.get(logFileNameSize - 1));

        while (true) {
            WatchKey key = watcher.take();
            for (WatchEvent<?> event : key.pollEvents()) {
                WatchEvent.Kind<?> kind = event.kind();
                if (kind == OVERFLOW) {
                    logger.warn("OVERFLOW");
                    continue;
                }
                byte[] tail = null;
                boolean noRetry = false;
                for (int retryCount = 0; retryCount < this.retryNum; retryCount++) {
                    try {
                        tail = getTail(this.targetFile);
                        break;
                    } catch (IOException ex) {
                        if (retryCount == this.retryNum - 1) {
                            noRetry = true;
                        }
                    }
                }
                // ?????????????????
                if (noRetry) {
                    break;
                }
                List<String> allFileName = getTargetLogFiles(Arrays.asList(targetDir.toFile().list()));
                Collections.sort(allFileName);
                int allFileNameSize = allFileName.size();
                if (tail.length > 0) {
                    String inputStr = new String(tail, this.encoding);
                    if (!allFileName.equals(targetFileNames)) {
                        this.newFileName.add(allFileName.get(allFileNameSize - 1));
                        targetFileNames = allFileName;
                    }

                    List<String> eachStr = Arrays.asList(inputStr.split(System.getProperty("line.separator")));
                    List<KeyedMessage<String, String>> list = getKeyedMessage(eachStr);
                    this.producer.send(list);
                } else {
                    if (!allFileName.equals(targetFileNames)) {
                        this.newFileName.add(allFileName.get(allFileNameSize - 1));
                        targetFileNames = allFileName;
                    }
                    if (this.newFileName.size() > 0) {
                        this.targetFile = new File(targetDir + "/" + this.newFileName.get(0));
                        this.newFileName.remove(0);
                        targetFileNames = allFileName;
                    }
                }
            }

            boolean valid = key.reset();
            if (!valid) {
                break;
            }
        }
    } catch (Exception ex) {
        // FindBugs?Java7????????FindBugs?????????
        logger.error("Failed start producer. ", ex);
    }
}

From source file:org.kegbot.app.HomeActivity.java

@Subscribe
public void onVisibleTapListUpdate(VisibleTapsChangedEvent event) {
    assert (Looper.myLooper() == Looper.getMainLooper());
    Log.d(LOG_TAG, "Got tap list change event: " + event + " taps=" + event.getTaps().size());

    final List<KegTap> newTapList = event.getTaps();
    synchronized (mTapsLock) {
        if (newTapList.equals(mTaps)) {
            Log.d(LOG_TAG, "Tap list unchanged.");
            return;
        }//from   w  ww. ja  va 2  s . co  m

        mTaps.clear();
        mTaps.addAll(newTapList);
        mTapStatusAdapter.notifyDataSetChanged();
    }

    //for progress bar
    if (mTaps.size() > 0) {
        final KegTap tap = mTaps.get(mTapStatusPager.getCurrentItem());
        if (tap.hasCurrentKeg()) {
            final Models.Keg keg = tap.getCurrentKeg();
            double remainml = keg.getRemainingVolumeMl();
            double totalml = keg.getFullVolumeMl();
            double percent = (remainml) / (totalml) * 100;

            final ProgressBar mTapProgress = (ProgressBar) findViewById(R.id.tapProgress);
            mTapProgress.setMax((int) totalml);
            mTapProgress.setProgress((int) remainml);

            final TextView mTapPercentage = (TextView) findViewById(R.id.tapPercentage);
            mTapPercentage.setText(String.format("%.2f", percent) + "%");
        }
    }

    maybeShowTapWarnings();
}

From source file:org.apache.ivy.plugins.repository.vfs.VfsResourceTest.java

/**
 * Validate getChildren when given a VFS URI for a directory
 *///w w w.j a v a  2 s. c o  m
public void testListFolderChildren() throws Exception {
    final String testFolder = "2/mod10.1";
    final List expectedFiles = Arrays
            .asList(new String[] { "ivy-1.0.xml", "ivy-1.1.xml", "ivy-1.2.xml", "ivy-1.3.xml" });

    Iterator baseVfsURIs = helper.createVFSUriSet(testFolder).iterator();
    while (baseVfsURIs.hasNext()) {
        VfsURI baseVfsURI = (VfsURI) baseVfsURIs.next();

        List expected = new ArrayList();
        for (int i = 0; i < expectedFiles.size(); i++) {
            String resId = baseVfsURI.toString() + "/" + expectedFiles.get(i);
            expected.add(resId);
        }

        List actual = new ArrayList();
        VfsResource res = new VfsResource(baseVfsURI.toString(), helper.fsManager);
        Iterator children = res.getChildren().iterator();
        while (children.hasNext()) {
            String resId = (String) children.next();
            // remove entries ending in .svn
            if (!resId.endsWith(".svn")) {
                actual.add(resId);
            }
        }

        Collections.sort(actual);
        Collections.sort(expected);
        if (!actual.equals(expected)) {
            fail("\nExpected: " + expected.toString() + "\n.Actual: " + actual.toString());
        }
    }
}

From source file:net.sf.jabref.collab.ChangeScanner.java

private void scanMetaData(MetaData inMem1, MetaData inTemp1, MetaData onDisk) {
    MetaDataChange mdc = new MetaDataChange(inMem1, inTemp1);
    List<String> handledOnDisk = new ArrayList<>();
    // Loop through the metadata entries of the "tmp" database, looking for
    // matches//  w  w  w . ja v a 2  s. c o m
    for (String key : inTemp1) {
        // See if the key is missing in the disk database:
        List<String> vod = onDisk.getData(key);
        if (vod == null) {
            mdc.insertMetaDataRemoval(key);
        } else {
            // Both exist. Check if they are different:
            List<String> vit = inTemp1.getData(key);
            if (!vod.equals(vit)) {
                mdc.insertMetaDataChange(key, vod);
            }
            // Remember that we've handled this one:
            handledOnDisk.add(key);
        }
    }

    // See if there are unhandled keys in the disk database:
    for (String key : onDisk) {
        if (!handledOnDisk.contains(key)) {
            mdc.insertMetaDataAddition(key, onDisk.getData(key));
        }
    }

    if (mdc.getChangeCount() > 0) {
        changes.add(mdc);
    }
}

From source file:com.ciphertool.genetics.algorithms.mutation.cipherkey.RandomValueMutationAlgorithmTest.java

@Test
public void testMutateChromosome() {
    randomValueMutationAlgorithm.setMaxMutationsPerChromosome(MAX_MUTATIONS);

    MockKeyedChromosome mockKeyedChromosome = new MockKeyedChromosome();
    List<Gene> originalGenes = new ArrayList<Gene>();

    MockGene mockGene1 = new MockGene();
    mockKeyedChromosome.putGene("1", mockGene1);
    originalGenes.add(mockGene1);//from  w  w w  .  jav a  2 s  .co  m

    MockGene mockGene2 = new MockGene();
    mockKeyedChromosome.putGene("2", mockGene2);
    originalGenes.add(mockGene2);

    MockGene mockGeneToReturn = new MockGene();
    when(geneDaoMock.findRandomGene(same(mockKeyedChromosome))).thenReturn(mockGeneToReturn);

    randomValueMutationAlgorithm.mutateChromosome(mockKeyedChromosome);

    assertFalse(originalGenes.equals(mockKeyedChromosome.getGenes()));
    verify(geneDaoMock, atLeastOnce()).findRandomGene(same(mockKeyedChromosome));
    verify(geneDaoMock, atMost(2)).findRandomGene(same(mockKeyedChromosome));
    verifyZeroInteractions(logMock);
}

From source file:org.codice.ddf.registry.source.configuration.SourceConfigurationHandler.java

public synchronized void setSourceActivationPriorityOrder(List<String> sourceActivationPriorityOrder) {
    if (!sourceActivationPriorityOrder.equals(this.sourceActivationPriorityOrder)) {
        this.sourceActivationPriorityOrder.clear();
        this.sourceActivationPriorityOrder.addAll(sourceActivationPriorityOrder);

        if (!activateConfigurations && preserveActiveConfigurations) {
            return;
        }/*w w w . j  ava2  s  . c om*/

        updateRegistrySourceConfigurations();
    }
}