Example usage for java.util List clear

List of usage examples for java.util List clear

Introduction

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

Prototype

void clear();

Source Link

Document

Removes all of the elements from this list (optional operation).

Usage

From source file:com.hp.autonomy.types.idol.marshalling.marshallers.jaxb2.Jaxb2QueryResponseDataParser.java

@Override
public Autnresponse parseResponse(final InputStream inputStream) throws AciErrorException {
    final Autnresponse autnresponse = responseDataMarshaller.parseResponse(inputStream);
    final R responseData = responseDataType.cast(autnresponse.getResponseData());
    responseData.getHits().forEach(hit -> {
        final DocContent contentWrapper = hit.getContent();
        if (contentWrapper != null && !contentWrapper.getContent().isEmpty()) {
            final List<Object> contentNodes = contentWrapper.getContent();
            final Node contentNode = (Node) contentNodes.get(0);
            final C contentObject = contentType.cast(marshaller.unmarshal(new DOMSource(contentNode)));
            contentNodes.clear();
            contentNodes.add(contentObject);
        }/*  w w w  . jav a2  s .  c  o  m*/
    });

    return autnresponse;
}

From source file:ca.weblite.contacts.webservice.RESTServiceConfiguration.java

@Override
public void extendMessageConverters(List<HttpMessageConverter<?>> converters) {

    System.out.println("Extending converters");
    converters.clear();
    converters.add(serializedDTOObjectConverter());
    //System.out.println("Converters "+converters);
}

From source file:com.googlecode.psiprobe.model.stats.StatsCollection.java

public synchronized void resetStats(String name) {
    List stats = getStats(name);
    if (stats != null) {
        stats.clear();
    }// ww w. j  a v  a  2s  .com
}

From source file:com.liato.bankdroid.banking.banks.sebkort.SEBKortBase.java

@Override
protected LoginPackage preLogin() throws BankException, ClientProtocolException, IOException {
    urlopen = new Urllib(context, CertificateReader.getCertificates(context, mCertificates));
    //Get required cookies
    response = urlopen/*ww w.  j a v a  2 s.c o m*/
            .open(String.format("https://%s/nis/m/%s/external/t/login/index", mApiBase, mProviderPart));
    List<NameValuePair> postData = new ArrayList<NameValuePair>();
    postData.clear();
    postData.add(new BasicNameValuePair("SEB_Referer", "/nis"));
    postData.add(new BasicNameValuePair("SEB_Auth_Mechanism", "5"));
    postData.add(new BasicNameValuePair("TYPE", "LOGIN"));
    postData.add(new BasicNameValuePair("CURRENT_METHOD", "PWD"));
    postData.add(new BasicNameValuePair("UID", mProdgroup + username.toUpperCase()));
    postData.add(new BasicNameValuePair("PASSWORD", password));
    postData.add(new BasicNameValuePair("mProdgroup", mProdgroup));
    postData.add(mParamsTarget);
    postData.add(mParamsErrorTarget);
    return new LoginPackage(urlopen, postData, response,
            String.format("https://%s/auth4/Authentication/select.jsp", mApiBase));
}

From source file:com.netsteadfast.greenstep.util.FSUtils.java

public static List<String> findFileListByCondition(final String directory, final String sub_name[],
        final String content) {
    List<String> list1 = new ArrayList<String>();
    List<String> findList = new ArrayList<String>();
    File dir = new File(directory);
    if (dir != null) {
        if (dir.isDirectory()) {
            findFileNext(directory, findList);
            String f[] = null;/*from w  w w  . ja va2s  . c  o m*/
            f = new String[findList.size()];
            for (int ix = 0; ix < findList.size(); ix++) {
                f[ix] = findList.get(ix);
            }
            for (int ix = 0; f != null && ix < f.length; ix++) {
                boolean found_sub = false;
                for (int jx = 0; jx < sub_name.length && !found_sub; jx++) {
                    if (f[ix].toUpperCase().indexOf(sub_name[jx].toUpperCase()) > -1) {
                        found_sub = true;
                    }
                }
                if (found_sub) {
                    if (readStr(f[ix]).indexOf(content) > -1) {
                        list1.add(f[ix]);
                    }
                }

            }
            f = null;
        }
    }
    dir = null;
    findList.clear();
    return list1;
}

From source file:com.kii.sdk.photocolle.http.entity.mime.Header.java

public void setField(final MinimalField field) {
    if (field == null) {
        return;/*from   w  w w  .j  a va2 s . c o m*/
    }
    String key = field.getName().toLowerCase(Locale.US);
    List<MinimalField> list = fieldMap.get(key);
    if (list == null || list.isEmpty()) {
        addField(field);
        return;
    }
    list.clear();
    list.add(field);
    int firstOccurrence = -1;
    int index = 0;
    for (Iterator<MinimalField> it = this.fields.iterator(); it.hasNext(); index++) {
        MinimalField f = it.next();
        if (f.getName().equalsIgnoreCase(field.getName())) {
            it.remove();
            if (firstOccurrence == -1) {
                firstOccurrence = index;
            }
        }
    }
    this.fields.add(firstOccurrence, field);
}

From source file:com.bah.culvert.tableadapters.HBaseLocalTableAdapter.java

@Override
public Iterator<Result> get(Get get) {
    // Get the range list
    List<CRange> culvertRangeList = get.getRanges();

    // Only scan the tables if we have a range
    if (culvertRangeList.size() > 0) {

        List<Result> results = new ArrayList<Result>();

        // Get the reference to the HRegion
        HRegion hregion = null;/*from w w w.j a va  2  s.c o  m*/
        try {
            hregion = ((RegionCoprocessorEnvironment) this.ENDPOINT.getEnvironment()).getRegion();
        } catch (Exception e) {
            throw new RuntimeException(this.getTableName() + " Unable to get HRegion", e);
        }
        try {
            // Loop through the ranges
            for (CRange cr : culvertRangeList) {
                Scan scan = new Scan(cr.getStart(), cr.getEnd());
                // add columns to the scanner
                for (CColumn cc : get.getColumns()) {
                    scan.addColumn(cc.getColumnFamily(), cc.getColumnQualifier());
                }
                InternalScanner scanner = hregion.getScanner(scan);
                try {
                    List<KeyValue> curVals = new ArrayList<KeyValue>();
                    boolean hasMore = false;
                    do {
                        curVals.clear();
                        hasMore = scanner.next(curVals);
                        KeyValue kv = curVals.get(0);
                        results.add(new Result(kv.getRow(), new CKeyValue(kv.getKey(), kv.getFamily(),
                                kv.getQualifier(), kv.getTimestamp(), kv.getValue())));
                    } while (hasMore);
                } finally {
                    scanner.close();
                }
            }
        } catch (IOException e) {
            throw new RuntimeException(this.getTableName() + " Failed to iterate through table", e);
        }

        return results.iterator();
    }
    // There were no ranges in the list, so return an empty iterator
    return EmptyIterator.INSTANCE;
}

From source file:com.googlecode.osde.internal.editors.pref.UserPrefsPart.java

public void setValuesToModule() {
    Module module = getModule();// w  w  w .ja va 2  s  .co m
    List<UserPref> userPrefList = module.getUserPref();
    userPrefList.clear();
    List<UserPrefModel> models = getUserPrefs();
    for (UserPrefModel model : models) {
        UserPref userPref = new UserPref();
        userPref.setName(model.getName());
        String displayName = model.getDisplayName();
        if (StringUtils.isNotEmpty(displayName)) {
            userPref.setDisplayName(displayName);
        }
        String defaultValue = model.getDefaultValue();
        if (StringUtils.isNotEmpty(defaultValue)) {
            userPref.setDefaultValue(defaultValue);
        }
        userPref.setRequired(String.valueOf(model.isRequired()));
        userPref.setDatatype(model.getDataType().getDisplayName());
        List<EnumValue> enumValueList = userPref.getEnumValue();
        enumValueList.clear();
        if (model.getDataType().equals(DataType.ENUM)) {
            for (Map.Entry<String, String> entry : model.getEnumValueMap().entrySet()) {
                EnumValue enumValue = new EnumValue();
                enumValue.setValue(entry.getKey());
                enumValue.setDisplayValue(entry.getValue());
                enumValueList.add(enumValue);
            }
        } else {
            // Clear enum values in model because it be fixed.
            model.getEnumValueMap().clear();
        }
        userPrefList.add(userPref);
    }
}

From source file:com.manydesigns.portofino.modules.DatabaseModule.java

@Override
public void init() {
    if (configuration.getBoolean(LIQUIBASE_ENABLED, true)) {
        logger.info("Setting up Liquibase");
        DatabaseFactory databaseFactory = DatabaseFactory.getInstance();
        logger.debug("Clearing Liquibase database factory registry");
        databaseFactory.clearRegistry();
        logger.debug("Clearing Liquibase database snapshot generator factory registry");
        List<DatabaseSnapshotGenerator> registry = DatabaseSnapshotGeneratorFactory.getInstance().getRegistry();
        registry.clear();
        SqlGeneratorFactory.getInstance().register(new PortofinoSelectFromDatabaseChangeLogLockGenerator());
    } else {/*  w ww .  j a v  a 2s .  com*/
        logger.info("Liquibase is disabled");
    }

    logger.info("Initializing persistence");
    DatabasePlatformsRegistry databasePlatformsRegistry = new DatabasePlatformsRegistry(configuration);

    persistence = new Persistence(applicationDirectory, configuration, databasePlatformsRegistry);
    Injections.inject(persistence, servletContext, null);
    servletContext.setAttribute(DATABASE_PLATFORMS_REGISTRY, databasePlatformsRegistry);
    servletContext.setAttribute(PERSISTENCE, persistence);

    appendToAdminMenu();
    // hongliangpan add
    DbUtils.setPersistence(persistence);
    status = ModuleStatus.ACTIVE;
}

From source file:com.googlecode.osde.internal.editors.basic.IconPart.java

public void setValuesToModule() {
    Module module = getModule();/*from w  w  w .  j  a v  a 2s . co  m*/
    ModulePrefs modulePrefs = module.getModulePrefs();
    List<Icon> icons = modulePrefs.getIcons();
    icons.clear();

    if (useButton.getSelection()) {
        Icon icon = new Icon();
        if (urlRadio.getSelection()) {
            icon.setValue(urlText.getText());
        } else if (base64Radio.getSelection()) {
            icon.setMode("base64");
            icon.setType(base64TypeText.getText());
            icon.setValue(encodedIcon);
        }
        icons.add(icon);
    }
}