Java Code Examples for java.util.LinkedList#set()

The following examples show how to use java.util.LinkedList#set() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: PolicyTool.java    From TencentKona-8 with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Add a Principal entry to an existing PolicyEntry at the specified index.
 * A Principal entry consists of a class, and name.
 *
 * If the principal already exists, it is not added again.
 */
boolean addPrinEntry(PolicyEntry pe,
                    PolicyParser.PrincipalEntry newPrin,
                    int index) {

    // first add the principal to the Policy Parser entry
    PolicyParser.GrantEntry grantEntry = pe.getGrantEntry();
    if (grantEntry.contains(newPrin) == true)
        return false;

    LinkedList<PolicyParser.PrincipalEntry> prinList =
                                            grantEntry.principals;
    if (index != -1)
        prinList.set(index, newPrin);
    else
        prinList.add(newPrin);

    modified = true;
    return true;
}
 
Example 2
Source File: PolicyTool.java    From jdk8u60 with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Add a Principal entry to an existing PolicyEntry at the specified index.
 * A Principal entry consists of a class, and name.
 *
 * If the principal already exists, it is not added again.
 */
boolean addPrinEntry(PolicyEntry pe,
                    PolicyParser.PrincipalEntry newPrin,
                    int index) {

    // first add the principal to the Policy Parser entry
    PolicyParser.GrantEntry grantEntry = pe.getGrantEntry();
    if (grantEntry.contains(newPrin) == true)
        return false;

    LinkedList<PolicyParser.PrincipalEntry> prinList =
                                            grantEntry.principals;
    if (index != -1)
        prinList.set(index, newPrin);
    else
        prinList.add(newPrin);

    modified = true;
    return true;
}
 
Example 3
Source File: PolicyTool.java    From openjdk-jdk8u with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Add a Principal entry to an existing PolicyEntry at the specified index.
 * A Principal entry consists of a class, and name.
 *
 * If the principal already exists, it is not added again.
 */
boolean addPrinEntry(PolicyEntry pe,
                    PolicyParser.PrincipalEntry newPrin,
                    int index) {

    // first add the principal to the Policy Parser entry
    PolicyParser.GrantEntry grantEntry = pe.getGrantEntry();
    if (grantEntry.contains(newPrin) == true)
        return false;

    LinkedList<PolicyParser.PrincipalEntry> prinList =
                                            grantEntry.principals;
    if (index != -1)
        prinList.set(index, newPrin);
    else
        prinList.add(newPrin);

    modified = true;
    return true;
}
 
Example 4
Source File: PolicyTool.java    From dragonwell8_jdk with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Add a Principal entry to an existing PolicyEntry at the specified index.
 * A Principal entry consists of a class, and name.
 *
 * If the principal already exists, it is not added again.
 */
boolean addPrinEntry(PolicyEntry pe,
                    PolicyParser.PrincipalEntry newPrin,
                    int index) {

    // first add the principal to the Policy Parser entry
    PolicyParser.GrantEntry grantEntry = pe.getGrantEntry();
    if (grantEntry.contains(newPrin) == true)
        return false;

    LinkedList<PolicyParser.PrincipalEntry> prinList =
                                            grantEntry.principals;
    if (index != -1)
        prinList.set(index, newPrin);
    else
        prinList.add(newPrin);

    modified = true;
    return true;
}
 
Example 5
Source File: PolicyTool.java    From jdk8u-dev-jdk with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Add a Principal entry to an existing PolicyEntry at the specified index.
 * A Principal entry consists of a class, and name.
 *
 * If the principal already exists, it is not added again.
 */
boolean addPrinEntry(PolicyEntry pe,
                    PolicyParser.PrincipalEntry newPrin,
                    int index) {

    // first add the principal to the Policy Parser entry
    PolicyParser.GrantEntry grantEntry = pe.getGrantEntry();
    if (grantEntry.contains(newPrin) == true)
        return false;

    LinkedList<PolicyParser.PrincipalEntry> prinList =
                                            grantEntry.principals;
    if (index != -1)
        prinList.set(index, newPrin);
    else
        prinList.add(newPrin);

    modified = true;
    return true;
}
 
Example 6
Source File: PolicyTool.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Add a Principal entry to an existing PolicyEntry at the specified index.
 * A Principal entry consists of a class, and name.
 *
 * If the principal already exists, it is not added again.
 */
boolean addPrinEntry(PolicyEntry pe,
                    PolicyParser.PrincipalEntry newPrin,
                    int index) {

    // first add the principal to the Policy Parser entry
    PolicyParser.GrantEntry grantEntry = pe.getGrantEntry();
    if (grantEntry.contains(newPrin) == true)
        return false;

    LinkedList<PolicyParser.PrincipalEntry> prinList =
                                            grantEntry.principals;
    if (index != -1)
        prinList.set(index, newPrin);
    else
        prinList.add(newPrin);

    modified = true;
    return true;
}
 
Example 7
Source File: PolicyTool.java    From openjdk-jdk9 with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Add a Principal entry to an existing PolicyEntry at the specified index.
 * A Principal entry consists of a class, and name.
 *
 * If the principal already exists, it is not added again.
 */
boolean addPrinEntry(PolicyEntry pe,
                    PolicyParser.PrincipalEntry newPrin,
                    int index) {

    // first add the principal to the Policy Parser entry
    PolicyParser.GrantEntry grantEntry = pe.getGrantEntry();
    if (grantEntry.contains(newPrin) == true)
        return false;

    LinkedList<PolicyParser.PrincipalEntry> prinList =
                                            grantEntry.principals;
    if (index != -1)
        prinList.set(index, newPrin);
    else
        prinList.add(newPrin);

    modified = true;
    return true;
}
 
Example 8
Source File: PolicyTool.java    From jdk8u-jdk with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Add a Principal entry to an existing PolicyEntry at the specified index.
 * A Principal entry consists of a class, and name.
 *
 * If the principal already exists, it is not added again.
 */
boolean addPrinEntry(PolicyEntry pe,
                    PolicyParser.PrincipalEntry newPrin,
                    int index) {

    // first add the principal to the Policy Parser entry
    PolicyParser.GrantEntry grantEntry = pe.getGrantEntry();
    if (grantEntry.contains(newPrin) == true)
        return false;

    LinkedList<PolicyParser.PrincipalEntry> prinList =
                                            grantEntry.principals;
    if (index != -1)
        prinList.set(index, newPrin);
    else
        prinList.add(newPrin);

    modified = true;
    return true;
}
 
Example 9
Source File: PolicyTool.java    From jdk8u-jdk with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Add a Principal entry to an existing PolicyEntry at the specified index.
 * A Principal entry consists of a class, and name.
 *
 * If the principal already exists, it is not added again.
 */
boolean addPrinEntry(PolicyEntry pe,
                    PolicyParser.PrincipalEntry newPrin,
                    int index) {

    // first add the principal to the Policy Parser entry
    PolicyParser.GrantEntry grantEntry = pe.getGrantEntry();
    if (grantEntry.contains(newPrin) == true)
        return false;

    LinkedList<PolicyParser.PrincipalEntry> prinList =
                                            grantEntry.principals;
    if (index != -1)
        prinList.set(index, newPrin);
    else
        prinList.add(newPrin);

    modified = true;
    return true;
}
 
Example 10
Source File: PolicyTool.java    From hottub with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Add a Principal entry to an existing PolicyEntry at the specified index.
 * A Principal entry consists of a class, and name.
 *
 * If the principal already exists, it is not added again.
 */
boolean addPrinEntry(PolicyEntry pe,
                    PolicyParser.PrincipalEntry newPrin,
                    int index) {

    // first add the principal to the Policy Parser entry
    PolicyParser.GrantEntry grantEntry = pe.getGrantEntry();
    if (grantEntry.contains(newPrin) == true)
        return false;

    LinkedList<PolicyParser.PrincipalEntry> prinList =
                                            grantEntry.principals;
    if (index != -1)
        prinList.set(index, newPrin);
    else
        prinList.add(newPrin);

    modified = true;
    return true;
}
 
Example 11
Source File: PolicyTool.java    From openjdk-8-source with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Add a Principal entry to an existing PolicyEntry at the specified index.
 * A Principal entry consists of a class, and name.
 *
 * If the principal already exists, it is not added again.
 */
boolean addPrinEntry(PolicyEntry pe,
                    PolicyParser.PrincipalEntry newPrin,
                    int index) {

    // first add the principal to the Policy Parser entry
    PolicyParser.GrantEntry grantEntry = pe.getGrantEntry();
    if (grantEntry.contains(newPrin) == true)
        return false;

    LinkedList<PolicyParser.PrincipalEntry> prinList =
                                            grantEntry.principals;
    if (index != -1)
        prinList.set(index, newPrin);
    else
        prinList.add(newPrin);

    modified = true;
    return true;
}
 
Example 12
Source File: PolicyTool.java    From openjdk-8 with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Add a Principal entry to an existing PolicyEntry at the specified index.
 * A Principal entry consists of a class, and name.
 *
 * If the principal already exists, it is not added again.
 */
boolean addPrinEntry(PolicyEntry pe,
                    PolicyParser.PrincipalEntry newPrin,
                    int index) {

    // first add the principal to the Policy Parser entry
    PolicyParser.GrantEntry grantEntry = pe.getGrantEntry();
    if (grantEntry.contains(newPrin) == true)
        return false;

    LinkedList<PolicyParser.PrincipalEntry> prinList =
                                            grantEntry.principals;
    if (index != -1)
        prinList.set(index, newPrin);
    else
        prinList.add(newPrin);

    modified = true;
    return true;
}
 
Example 13
Source File: PolicyTool.java    From jdk8u_jdk with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Add a Principal entry to an existing PolicyEntry at the specified index.
 * A Principal entry consists of a class, and name.
 *
 * If the principal already exists, it is not added again.
 */
boolean addPrinEntry(PolicyEntry pe,
                    PolicyParser.PrincipalEntry newPrin,
                    int index) {

    // first add the principal to the Policy Parser entry
    PolicyParser.GrantEntry grantEntry = pe.getGrantEntry();
    if (grantEntry.contains(newPrin) == true)
        return false;

    LinkedList<PolicyParser.PrincipalEntry> prinList =
                                            grantEntry.principals;
    if (index != -1)
        prinList.set(index, newPrin);
    else
        prinList.add(newPrin);

    modified = true;
    return true;
}
 
Example 14
Source File: VisualisationUtilities.java    From chipster with MIT License 5 votes vote down vote up
public static Variable[] getVariablesFilteredExclusive(DataBean dataBean, Collection<String> columnsToRemove, boolean removeStart) {

		LinkedList<Variable> filteredVars = new LinkedList<Variable>();
		LinkedList<Variable> allVars = new LinkedList<Variable>();
		allVars.addAll(Arrays.asList(getVariablesFilteredInclusive(dataBean, "", false)));
		filteredVars.addAll(allVars);

		String hidden = "chip.";

		for (Variable var : allVars) {
			for (String colToRemove : columnsToRemove) {
				if (var.getName().startsWith(colToRemove)) {
					filteredVars.remove(var);
				}
			}

			if (removeStart && var.getName().startsWith(hidden)) {
				String chipName = var.getName().substring(hidden.length());
				filteredVars.set(filteredVars.indexOf(var), new Variable(chipName, var.getExpression()));
			}

			if (filteredVars.contains(var)) {
				if (var.getName().equals(" ")) {
					filteredVars.set(filteredVars.indexOf(var), new Variable("identifier", var.getExpression()));
				}
			}
		}

		return filteredVars.toArray(new Variable[0]);
	}
 
Example 15
Source File: ArbitrarySetTest.java    From skywalking with Apache License 2.0 5 votes vote down vote up
@Benchmark
public void linkedList() {
    LinkedList<Object> list = new LinkedList<Object>(Collections.nCopies(20, PLACEHOLDER));
    for (int i = 0; i < 100; i++) {
        int oldSize = list.size();
        if (i >= oldSize) {
            int newSize = Math.max(oldSize * 2, i);
            list.addAll(oldSize, Collections.nCopies(newSize - oldSize, PLACEHOLDER));
        }
        list.set(i, i);
    }
}
 
Example 16
Source File: CommandInjection.java    From Android_Code_Arbiter with GNU Lesser General Public License v3.0 5 votes vote down vote up
private String transferThroughList(String in, int index) {
    LinkedList<String> list = new LinkedList<String>();
    list.add(System.getenv("")); // taints the list
    list.clear(); // makes the list safe again
    list.add(1, "xx");
    list.addFirst(in); // can taint the list
    list.addLast("yy");
    list.push(in);
    return list.element() + list.get(index) + list.getFirst() + list.getLast()
            + list.peek() + list.peekFirst() + list.peekLast() + list.poll()
            + list.pollFirst() + list.pollLast() + list.pop() + list.remove()
            + list.remove(index) + list.removeFirst() + list.removeLast()
            + list.set(index, "safe") + list.toString();
}
 
Example 17
Source File: JobServiceImpl.java    From EasyML with Apache License 2.0 5 votes vote down vote up
/**
 * Update a EML job in the database
 * @param bdaJobName
 * @param bdaJobId
 * @param graph
 * @param account
 * @param desc
 * @return Bda job object
 * @throws Exception
 */
private BdaJob updateBdaJob(String bdaJobName, String bdaJobId,
		OozieGraph graph, String account, String desc) throws Exception {

	if (bdaJobName == null)
		bdaJobName = "Not Specified";
	BdaJob job = new BdaJob();
	job.setJobName(bdaJobName);
	job.setJobId(bdaJobId);
	job.setGraphxml(graph.toXML());
	job.setAccount(account);
	job.setDesc(desc);
	job.setLastSubmitTime(TimeUtils.getTime());

	String[] cond = {"job_id"};
	String[] sets = {"job_name", "graphxml", "account", "description",
	"last_submit_time"};
	
	//Modify the programs in the graph xml of the bda job to latest
    OozieGraph tmpGraph = OozieGraphXMLParser.parse(graph.toXML());
    LinkedList<OozieProgramNode> proNodes =  tmpGraph.getProgramNodes();
    for(int i=0 ; i < proNodes.size() ; i++)
    {
      OozieProgramNode proNode = proNodes.get(i);
      proNode.setOozJobId("latest");
      proNodes.set(i, proNode  );
    }
    job.setGraphxml(tmpGraph.toXML());
    
	SecureDao.update(job, sets, cond);
	job.setOozieGraph(graph);
	return job;
}
 
Example 18
Source File: JobServiceImpl.java    From EasyML with Apache License 2.0 5 votes vote down vote up
/**
 * Create a EML job in database
 * @param bdaJobName
 * @param bdaJobId
 * @param graph
 * @param account
 * @param desc
 * @return
 * @throws Exception
 */
private BdaJob createBdaJob(String bdaJobName, String bdaJobId,
		OozieGraph graph, String account, String desc) throws Exception {

	if (bdaJobName == null)
		bdaJobName = "Not Specified";
	if (bdaJobId == null)
		bdaJobId = GenerateSequenceUtil.generateSequenceNo() + "-bda";

	// Create the corresponding bda job in the database
	BdaJob job = new BdaJob();
	job.setJobName(bdaJobName);
	job.setJobId(bdaJobId);
	job.setGraphxml(graph.toXML());
	job.setAccount(account);
	job.setDesc(desc);
	job.setLastSubmitTime(TimeUtils.getTime());

	//Modify the programs in the graph xml of the bda job to latest
	OozieGraph tmpGraph = OozieGraphXMLParser.parse(graph.toXML());
	LinkedList<OozieProgramNode> proNodes =  tmpGraph.getProgramNodes();
	for(int i=0 ; i < proNodes.size() ; i++)
	{
		OozieProgramNode proNode = proNodes.get(i);
		proNode.setOozJobId("latest");
		proNode.setWorkPath("${appPath}/" + proNode.getId() + "/");
		proNodes.set(i, proNode	);
	}
	job.setGraphxml(tmpGraph.toXML());
	SecureDao.insert(job);

	job.setOozieGraph(graph);
	return job;
}
 
Example 19
Source File: BinaryObjectBuilderAdditionalSelfTest.java    From ignite with Apache License 2.0 4 votes vote down vote up
/**
 *
 */
@Test
public void testLinkedListWriteUnmodifiable() {
    GridBinaryTestClasses.TestObjectContainer obj = new GridBinaryTestClasses.TestObjectContainer();

    LinkedList<Object> src = Lists.newLinkedList(Arrays.asList(obj, "a", "b", "c"));

    obj.foo = src;

    BinaryObjectBuilderImpl mutObj = wrap(obj);

    GridBinaryTestClasses.TestObjectContainer deserialized = mutObj.build().deserialize();

    List<Object> res = (List<Object>)deserialized.foo;

    src.set(0, deserialized);

    assertEquals(src, res);
}
 
Example 20
Source File: ChipsterGBrowserVisualisation.java    From chipster with MIT License 4 votes vote down vote up
@Override
public LinkedList<String> getSampleNames(LinkedList<String> sampleNames, DataUrl dataUrl) {
				
	DataBean bean = ((BeanDataFile)dataUrl).bean;
	
	try {
		for (int i = 0; i < sampleNames.size(); i++) {

			String internalName = sampleNames.get(i);

			String sampleName;
			sampleName = bean.queryFeatures("/phenodata/linked/describe/" + internalName).asString();

			sampleNames.set(i, sampleName);				
		}

	} catch (MicroarrayException e) {
		//Use internal names
	}
	
	return sampleNames;
}