Example usage for java.util List remove

List of usage examples for java.util List remove

Introduction

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

Prototype

E remove(int index);

Source Link

Document

Removes the element at the specified position in this list (optional operation).

Usage

From source file:io.servicecomb.swagger.generator.pojo.PojoSwaggerGeneratorContext.java

protected void mergeBodyBasedParameters(OperationGenerator operationGenerator,
        List<BodyParameter> bodyParameters) {
    List<Parameter> swaggerParameters = operationGenerator.getSwaggerParameters();
    for (Parameter parameter : bodyParameters) {
        swaggerParameters.remove(parameter);
    }/*from w  w w .ja va2 s.  co m*/

    // bodyclass?body?
    String bodyParamName = ParamUtils.generateBodyParameterName(operationGenerator.getProviderMethod());
    Class<?> cls = ClassUtils.getOrCreateBodyClass(operationGenerator, bodyParameters);
    BodyParameter bodyParameter = ParamUtils.createBodyParameter(operationGenerator.getSwagger(), bodyParamName,
            cls);
    swaggerParameters.add(bodyParameter);
}

From source file:net.firstpartners.nounit.utility.XmlUtil.java

/**
 * gets all elements in the XML Document Being Passed in <BR>
 * @param inXmlDocument to generated the hashmap from
 * @return nodeList containing nodes//from  w w  w. j  a v a  2 s.  co  m
 */
public static HashSet getAllNodes(Document inXmlDocument) {

    //Internal Variables
    int stackPointer = 0;
    int index = 1;
    String locationId = null;
    Element currentElement = null;
    Element parentElement = null;
    Element thisElement = null;
    Attribute tmpAttribute = null;
    List elementList = null;
    ListIterator deepestList = null;

    HashMap mappings = new HashMap();
    HashSet nodeList = new HashSet();
    List stack = new Vector(); //Implements list interface

    //Get the list information for the entire document - kick start loop
    stack.add(inXmlDocument.getContent().listIterator());

    //Loop though the elements on list
    while (!stack.isEmpty()) {

        //Get the last list on the stack
        deepestList = (ListIterator) stack.get(stack.size() - 1);

        //Does this list have more elements?
        if (deepestList.hasNext()) {

            //if so Get Next element from this list
            thisElement = (Element) deepestList.next();

            // add this element to the list
            nodeList.add(thisElement);

            //does this list have children ?
            if (thisElement.hasChildren()) {

                //if so add to the stack
                stackPointer++;
                stack.add(thisElement.getChildren().listIterator());
            }
        } else {
            //if not , remove this list from the stack
            stack.remove(stackPointer);
            stackPointer--;

        } // end if stack has more elements

    }

    return nodeList;
}

From source file:org.bitsofinfo.util.address.usps.ais.loader.USPSParserTest.java

@Test
public void parseZipPlus4Sample() throws Exception {

    // locate the raw source data 
    List<String> lines = loadLinesFromFile("usps.ais.zipPlus4.sample.txt");

    assert (lines.size() == 40);

    // get the copyright
    Copyright copyright = uspsParser.parseCopyright(lines.remove(0));

    // load up all the data
    List<USPSRecord> records = uspsParser.parseData(USPSProductType.ZIP_PLUS_4, copyright, lines);

    assert (records.size() == 39);

}

From source file:org.bitsofinfo.util.address.usps.ais.USPSFullAddressTest.java

@Test
public void testZipPlus4DetailConvert() throws Exception {

    // locate the raw source data 
    List<String> lines = loadLinesFromFile("usps.ais.zipPlus4.sample.txt");

    assert (lines.size() == 40);

    // get the copyright
    Copyright copyright = uspsParser.parseCopyright(lines.remove(0));

    // load up all the data
    List<USPSRecord> records = uspsParser.parseData(USPSProductType.ZIP_PLUS_4, copyright, lines);

    assert (records.size() == 39);

    for (USPSRecord record : records) {
        if (record instanceof ZipPlus4Detail) {
            service.explode((ZipPlus4Detail) record);
        }//from w  ww  .  j  a v  a  2 s  .co m
    }

}

From source file:org.bitsofinfo.util.address.usps.ais.loader.USPSParserTest.java

@Test
public void parseCityStateSample() throws Exception {

    // locate the raw source data 
    List<String> lines = loadLinesFromFile("usps.ais.cityState.sample.txt");

    assert (lines.size() == 59);

    // get the copyright
    Copyright copyright = uspsParser.parseCopyright(lines.remove(0));

    // load up all the data
    List<USPSRecord> records = uspsParser.parseData(USPSProductType.CITY_STATE, copyright, lines);

    assert (records.size() == 58);

}

From source file:bit.changepurse.wdk.http.MockedApacheResponse.java

@Override
public void removeHeader(Header header) {
    List<Header> groupedHeaders = headers.get(header.getName());
    groupedHeaders.remove(header);
}

From source file:at.gv.egovernment.moa.id.storage.AuthenticationSessionStoreage.java

/**
 * @param entityID/*  w  w  w  .ja  v  a 2 s  . c om*/
 * @param requestID
 */
public static boolean removeInterfederetedSession(String entityID, String pedingRequestID) {

    try {
        Logger.debug("Remove interfederated IDP from local SSO session ...");

        MiscUtil.assertNotNull(pedingRequestID, "pedingRequestID");
        Logger.trace("Get authenticated session with pedingRequestID " + pedingRequestID + " from database.");
        Session session = MOASessionDBUtils.getCurrentSession();

        List<AuthenticatedSessionStore> result;

        synchronized (session) {
            session.beginTransaction();
            Query query = session.getNamedQuery("getSessionWithPendingRequestID");
            query.setParameter("sessionid", pedingRequestID);
            result = query.list();

            //send transaction
            session.getTransaction().commit();
        }

        Logger.trace("Found entries: " + result.size());

        //Assertion requires an unique artifact
        if (result.size() != 1) {
            Logger.trace("No entries found.");
            return false;
        }

        AuthenticatedSessionStore authsession = result.get(0);

        List<InterfederationSessionStore> idpSessions = authsession.getInderfederation();
        if (idpSessions != null) {
            for (InterfederationSessionStore idp : idpSessions) {
                if (idp.getIdpurlprefix().equals(entityID))
                    idpSessions.remove(idp);

            }
        }

        MOASessionDBUtils.saveOrUpdate(authsession);
        return true;

    } catch (Throwable e) {
        Logger.warn("MOASession deserialization-exception by using MOASessionID=" + pedingRequestID);
        return false;
    }
}

From source file:app.admin.career.DoUploadImgCareerActionSupport.java

public String execute() throws Exception {
    String destPath = "D:/hoctap/SEM4/ProjectSem4Strut2/web/images/career";
    DataProcess dataProcess = new DataProcess();
    String url = "";
    try {//from  w w  w  .j av  a  2 s  . co m
        Random rand = new Random();
        int ran = rand.nextInt();
        url = Integer.toString(ran) + ".jpg";
        File destFile = new File(destPath, url);
        FileUtils.copyFile(file, destFile);

    } catch (IOException e) {
        return "error";
    }
    url = "images/career/" + url;

    CareerJson careerJson = new CareerJson();
    List<CareerForJson> careerForJsons = careerJson.read();
    for (CareerForJson careerForJson : careerForJsons) {
        if (careerForJson.getCode().equals(code)) {
            careerForJsons.remove(careerForJson);
            careerForJson.setImage(url);
            careerForJsons.add(careerForJson);
            break;
        }
    }
    careerJson.write(careerForJsons);

    //        if(dataProcess.setAvata(codeWorker, url))
    //            return "index";
    //        return "error";
    return "admin";
}

From source file:at.ac.tuwien.dsg.cloud.utilities.messaging.lightweight.rabbitMq.RabbitMqConsumer.java

@Override
public RabbitMqConsumer removeMessageReceivedListener(MessageReceivedListener listener) {
    synchronized (this.messageListeners) {
        if (!this.messageListeners.containsKey(listener.getType())) {
            return this;
        }/*from   w ww  .j ava2 s .c  o  m*/

        List<MessageReceivedListener> list = this.messageListeners.get(listener.getType());

        synchronized (list) {
            list.remove(listener);
        }

        if (list.isEmpty()) {
            this.messageListeners.remove(listener.getType());
        }
    }
    return this;
}

From source file:geva.Operator.Operations.EliteReplacementOperation.java

/**
 * Sort ascending and remove the worst individuals
 * @param operand individuals to sort/*from  ww  w .  ja  v a2s .c  om*/
 */
public void doOperation(List<Individual> operand) {
    Collections.sort(operand);
    int cnt = operand.size();
    while (cnt > this.eliteSize && cnt > 0) {
        cnt--;
        operand.remove(cnt);
    }
}