java.util.LinkedList#set ( )源码实例Demo

下面列出了java.util.LinkedList#set ( ) 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。

源代码1 项目: dragonwell8_jdk   文件: PolicyTool.java
/**
 * 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;
}
 
源代码2 项目: TencentKona-8   文件: PolicyTool.java
/**
 * 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;
}
 
源代码3 项目: jdk8u60   文件: PolicyTool.java
/**
 * 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;
}
 
源代码4 项目: openjdk-jdk8u   文件: PolicyTool.java
/**
 * 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;
}
 
源代码5 项目: openjdk-jdk8u-backup   文件: PolicyTool.java
/**
 * 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;
}
 
源代码6 项目: openjdk-jdk9   文件: PolicyTool.java
/**
 * 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;
}
 
源代码7 项目: jdk8u-jdk   文件: PolicyTool.java
/**
 * 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;
}
 
源代码8 项目: hottub   文件: PolicyTool.java
/**
 * 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;
}
 
源代码9 项目: openjdk-8-source   文件: PolicyTool.java
/**
 * 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;
}
 
源代码10 项目: openjdk-8   文件: PolicyTool.java
/**
 * 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;
}
 
源代码11 项目: jdk8u_jdk   文件: PolicyTool.java
/**
 * 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;
}
 
源代码12 项目: jdk8u-jdk   文件: PolicyTool.java
/**
 * 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;
}
 
源代码13 项目: jdk8u-dev-jdk   文件: PolicyTool.java
/**
 * 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;
}
 
源代码14 项目: EasyML   文件: JobServiceImpl.java
/**
 * 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;
}
 
源代码15 项目: EasyML   文件: JobServiceImpl.java
/**
 * 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;
}
 
源代码16 项目: Android_Code_Arbiter   文件: CommandInjection.java
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();
}
 
源代码17 项目: skywalking   文件: ArbitrarySetTest.java
@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);
    }
}
 
源代码18 项目: chipster   文件: VisualisationUtilities.java
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]);
	}
 
源代码19 项目: chipster   文件: ChipsterGBrowserVisualisation.java
@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;
}
 
/**
 *
 */
@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);
}