Example usage for java.util Collections copy

List of usage examples for java.util Collections copy

Introduction

In this page you can find the example usage for java.util Collections copy.

Prototype

public static <T> void copy(List<? super T> dest, List<? extends T> src) 

Source Link

Document

Copies all of the elements from one list into another.

Usage

From source file:eu.europeana.uim.plugin.solr.service.SolrWorkflowPlugin.java

private <T> List<T> copyList(List<T> originalList) {
    List<T> copy = new ArrayList<T>(originalList.size());
    for (int i = 0; i < originalList.size(); i++) {

        copy.add(originalList.get(0));/*from www.  j  a v a2s. c o m*/
    }
    Collections.copy(copy, originalList);
    return copy;
}

From source file:com.mobicage.rogerthat.plugins.messaging.BrandingMgr.java

public void initialize(ConfigurationProvider cfgProvider, MainService mainService) {
    T.UI();//from  ww w . j  a  va  2 s  . c om
    mCfgProvider = cfgProvider;
    mMainService = mainService;
    mContext = mainService;

    List<BrandedItem> copy = new ArrayList<BrandingMgr.BrandedItem>();
    Collections.copy(mQueue, copy);
    for (BrandedItem item : copy)
        if (item.status != BrandedItem.STATUS_TODO)
            dequeue(item, false);

    mDownloaderThread = new HandlerThread("rogerthat_branding_worker");
    mDownloaderThread.start();
    Looper looper = mDownloaderThread.getLooper();
    mDownloaderHandler = new Handler(looper);

    IntentFilter filter = new IntentFilter();
    filter.addAction(Intent.ACTION_MEDIA_MOUNTED);
    filter.addAction(Intent.ACTION_MEDIA_REMOVED);
    filter.addAction(DownloadManager.ACTION_DOWNLOAD_COMPLETE);
    mContext.registerReceiver(mBroadcastReceiver, filter);
    initStorageSettings();

    mInitialized = true;

    mMainService.postOnBIZZHandler(new SafeRunnable() {
        @Override
        protected void safeRun() throws Exception {
            if (mMainService.getPluginDBUpdates(BrandingMgr.class).contains(MUST_DELETE_ATTACHMENTS_INTENT)) {
                synchronized (mLock) {
                    IOUtils.deleteRecursive(getAttachmentsRootDirectory());
                }
                mMainService.clearPluginDBUpdate(BrandingMgr.class, MUST_DELETE_ATTACHMENTS_INTENT);
            }
        }
    });
}