Java Code Examples for java.util.Hashtable.putAll()

The following are Jave code examples for showing how to use putAll() of the java.util.Hashtable class. You can vote up the examples you like. Your votes will be used in our system to get more good examples.
+ Save this method
Example 1
Project: unitimes   File: CourseSolverContainerRemote.java   View Source Code Vote up 6 votes
public Hashtable getAssignmentTable(Collection classesOrClassIds) throws Exception {
    Set deptIds = iRemoteSolverProxy.getDepartmentIds();
    Hashtable assignments = new Hashtable();
    Vector solverClassesOrClassIds = new Vector(classesOrClassIds.size());
    for (Iterator i=classesOrClassIds.iterator();i.hasNext();) {
        Object classOrClassId = i.next();
        if (classOrClassId instanceof Object[]) classOrClassId = ((Object[])classOrClassId)[0];
        Class_ clazz = (classOrClassId instanceof Class_ ? (Class_)classOrClassId : (new Class_DAO()).get((Long)classOrClassId));
        if (clazz.getManagingDept()==null || !deptIds.contains(clazz.getManagingDept().getUniqueId())) {
            Assignment assignment = iCommitedClassAssignmentProxy.getAssignment(clazz);
            if (assignment!=null)
                assignments.put(clazz.getUniqueId(), assignment);
        } else {
            solverClassesOrClassIds.add(clazz.getUniqueId());
        }
    }
    if (!solverClassesOrClassIds.isEmpty())
        assignments.putAll(iRemoteSolverProxy.getAssignmentTable2(solverClassesOrClassIds));
    return assignments;
}
 
Example 2
Project: unitimes   File: CourseSolverContainerRemote.java   View Source Code Vote up 6 votes
public Hashtable getAssignmentInfoTable(Collection classesOrClassIds) throws Exception {
    Set deptIds = iRemoteSolverProxy.getDepartmentIds();
    Hashtable infos = new Hashtable();
    Vector solverClassesOrClassIds = new Vector(classesOrClassIds.size());
    for (Iterator i=classesOrClassIds.iterator();i.hasNext();) {
        Object classOrClassId = i.next();
        if (classOrClassId instanceof Object[]) classOrClassId = ((Object[])classOrClassId)[0];
        Class_ clazz = (classOrClassId instanceof Class_ ? (Class_)classOrClassId : (new Class_DAO()).get((Long)classOrClassId));
        if (clazz.getManagingDept()==null || !deptIds.contains(clazz.getManagingDept().getUniqueId())) {
            AssignmentPreferenceInfo info = iCommitedClassAssignmentProxy.getAssignmentInfo(clazz);
            if (info!=null)
                infos.put(clazz.getUniqueId(), info);
        } else {
            solverClassesOrClassIds.add(clazz.getUniqueId());
        }
    }
    if (!solverClassesOrClassIds.isEmpty())
        infos.putAll(iRemoteSolverProxy.getAssignmentInfoTable2(solverClassesOrClassIds));
    return infos;
}
 
Example 3
Project: OpenJSharp   File: BasicPermission.java   View Source Code Vote up 6 votes
/**
 * @serialData Default fields.
 */
/*
 * Writes the contents of the perms field out as a Hashtable for
 * serialization compatibility with earlier releases. all_allowed
 * and permClass unchanged.
 */
private void writeObject(ObjectOutputStream out) throws IOException {
    // Don't call out.defaultWriteObject()

    // Copy perms into a Hashtable
    Hashtable<String, Permission> permissions =
            new Hashtable<>(perms.size()*2);

    synchronized (this) {
        permissions.putAll(perms);
    }

    // Write out serializable fields
    ObjectOutputStream.PutField pfields = out.putFields();
    pfields.put("all_allowed", all_allowed);
    pfields.put("permissions", permissions);
    pfields.put("permClass", permClass);
    out.writeFields();
}
 
Example 4
Project: OpenJSharp   File: Permissions.java   View Source Code Vote up 6 votes
/**
 * @serialData Default fields.
 */
/*
 * Writes the contents of the permsMap field out as a Hashtable for
 * serialization compatibility with earlier releases. allPermission
 * unchanged.
 */
private void writeObject(ObjectOutputStream out) throws IOException {
    // Don't call out.defaultWriteObject()

    // Copy perms into a Hashtable
    Hashtable<Class<?>, PermissionCollection> perms =
        new Hashtable<>(permsMap.size()*2); // no sync; estimate
    synchronized (this) {
        perms.putAll(permsMap);
    }

    // Write out serializable fields
    ObjectOutputStream.PutField pfields = out.putFields();

    pfields.put("allPermission", allPermission); // no sync; staleness OK
    pfields.put("perms", perms);
    out.writeFields();
}
 
Example 5
Project: OpenJSharp   File: Permissions.java   View Source Code Vote up 6 votes
/**
 * @serialData Default fields.
 */
/*
 * Writes the contents of the permsMap field out as a Hashtable for
 * serialization compatibility with earlier releases.
 */
private void writeObject(ObjectOutputStream out) throws IOException {
    // Don't call out.defaultWriteObject()

    // Copy perms into a Hashtable
    Hashtable<Permission, Permission> perms =
            new Hashtable<>(permsMap.size()*2);
    synchronized (this) {
        perms.putAll(permsMap);
    }

    // Write out serializable fields
    ObjectOutputStream.PutField pfields = out.putFields();
    pfields.put("perms", perms);
    out.writeFields();
}
 
Example 6
Project: OpenJSharp   File: PropertyPermission.java   View Source Code Vote up 6 votes
/**
 * @serialData Default fields.
 */
/*
 * Writes the contents of the perms field out as a Hashtable for
 * serialization compatibility with earlier releases. all_allowed
 * unchanged.
 */
private void writeObject(ObjectOutputStream out) throws IOException {
    // Don't call out.defaultWriteObject()

    // Copy perms into a Hashtable
    Hashtable<String, Permission> permissions =
        new Hashtable<>(perms.size()*2);
    synchronized (this) {
        permissions.putAll(perms);
    }

    // Write out serializable fields
    ObjectOutputStream.PutField pfields = out.putFields();
    pfields.put("all_allowed", all_allowed);
    pfields.put("permissions", permissions);
    out.writeFields();
}
 
Example 7
Project: jdk8u-jdk   File: BasicPermission.java   View Source Code Vote up 6 votes
/**
 * @serialData Default fields.
 */
/*
 * Writes the contents of the perms field out as a Hashtable for
 * serialization compatibility with earlier releases. all_allowed
 * and permClass unchanged.
 */
private void writeObject(ObjectOutputStream out) throws IOException {
    // Don't call out.defaultWriteObject()

    // Copy perms into a Hashtable
    Hashtable<String, Permission> permissions =
            new Hashtable<>(perms.size()*2);

    synchronized (this) {
        permissions.putAll(perms);
    }

    // Write out serializable fields
    ObjectOutputStream.PutField pfields = out.putFields();
    pfields.put("all_allowed", all_allowed);
    pfields.put("permissions", permissions);
    pfields.put("permClass", permClass);
    out.writeFields();
}
 
Example 8
Project: jdk8u-jdk   File: Permissions.java   View Source Code Vote up 6 votes
/**
 * @serialData Default fields.
 */
/*
 * Writes the contents of the permsMap field out as a Hashtable for
 * serialization compatibility with earlier releases. allPermission
 * unchanged.
 */
private void writeObject(ObjectOutputStream out) throws IOException {
    // Don't call out.defaultWriteObject()

    // Copy perms into a Hashtable
    Hashtable<Class<?>, PermissionCollection> perms =
        new Hashtable<>(permsMap.size()*2); // no sync; estimate
    synchronized (this) {
        perms.putAll(permsMap);
    }

    // Write out serializable fields
    ObjectOutputStream.PutField pfields = out.putFields();

    pfields.put("allPermission", allPermission); // no sync; staleness OK
    pfields.put("perms", perms);
    out.writeFields();
}
 
Example 9
Project: jdk8u-jdk   File: Permissions.java   View Source Code Vote up 6 votes
/**
 * @serialData Default fields.
 */
/*
 * Writes the contents of the permsMap field out as a Hashtable for
 * serialization compatibility with earlier releases.
 */
private void writeObject(ObjectOutputStream out) throws IOException {
    // Don't call out.defaultWriteObject()

    // Copy perms into a Hashtable
    Hashtable<Permission, Permission> perms =
            new Hashtable<>(permsMap.size()*2);
    synchronized (this) {
        perms.putAll(permsMap);
    }

    // Write out serializable fields
    ObjectOutputStream.PutField pfields = out.putFields();
    pfields.put("perms", perms);
    out.writeFields();
}
 
Example 10
Project: jdk8u-jdk   File: PropertyPermission.java   View Source Code Vote up 6 votes
/**
 * @serialData Default fields.
 */
/*
 * Writes the contents of the perms field out as a Hashtable for
 * serialization compatibility with earlier releases. all_allowed
 * unchanged.
 */
private void writeObject(ObjectOutputStream out) throws IOException {
    // Don't call out.defaultWriteObject()

    // Copy perms into a Hashtable
    Hashtable<String, Permission> permissions =
        new Hashtable<>(perms.size()*2);
    synchronized (this) {
        permissions.putAll(perms);
    }

    // Write out serializable fields
    ObjectOutputStream.PutField pfields = out.putFields();
    pfields.put("all_allowed", all_allowed);
    pfields.put("permissions", permissions);
    out.writeFields();
}
 
Example 11
Project: openjdk-jdk10   File: BasicPermission.java   View Source Code Vote up 6 votes
/**
 * @serialData Default fields.
 */
/*
 * Writes the contents of the perms field out as a Hashtable for
 * serialization compatibility with earlier releases. all_allowed
 * and permClass unchanged.
 */
private void writeObject(ObjectOutputStream out) throws IOException {
    // Don't call out.defaultWriteObject()

    // Copy perms into a Hashtable
    Hashtable<String, Permission> permissions =
            new Hashtable<>(perms.size()*2);

    permissions.putAll(perms);

    // Write out serializable fields
    ObjectOutputStream.PutField pfields = out.putFields();
    pfields.put("all_allowed", all_allowed);
    pfields.put("permissions", permissions);
    pfields.put("permClass", permClass);
    out.writeFields();
}
 
Example 12
Project: openjdk-jdk10   File: Permissions.java   View Source Code Vote up 6 votes
/**
 * @serialData Default fields.
 */
/*
 * Writes the contents of the permsMap field out as a Hashtable for
 * serialization compatibility with earlier releases. allPermission
 * unchanged.
 */
private void writeObject(ObjectOutputStream out) throws IOException {
    // Don't call out.defaultWriteObject()

    // Copy perms into a Hashtable
    Hashtable<Class<?>, PermissionCollection> perms =
        new Hashtable<>(permsMap.size()*2); // no sync; estimate
    perms.putAll(permsMap);

    // Write out serializable fields
    ObjectOutputStream.PutField pfields = out.putFields();

    pfields.put("allPermission", allPermission); // no sync; staleness OK
    pfields.put("perms", perms);
    out.writeFields();
}
 
Example 13
Project: openjdk-jdk10   File: Permissions.java   View Source Code Vote up 6 votes
/**
 * @serialData Default fields.
 */
/*
 * Writes the contents of the permsMap field out as a Hashtable for
 * serialization compatibility with earlier releases.
 */
private void writeObject(ObjectOutputStream out) throws IOException {
    // Don't call out.defaultWriteObject()

    // Copy perms into a Hashtable
    Hashtable<Permission, Permission> perms =
            new Hashtable<>(permsMap.size()*2);
    perms.putAll(permsMap);

    // Write out serializable fields
    ObjectOutputStream.PutField pfields = out.putFields();
    pfields.put("perms", perms);
    out.writeFields();
}
 
Example 14
Project: openjdk-jdk10   File: PropertyPermission.java   View Source Code Vote up 6 votes
/**
 * @serialData Default fields.
 */
/*
 * Writes the contents of the perms field out as a Hashtable for
 * serialization compatibility with earlier releases. all_allowed
 * unchanged.
 */
private void writeObject(ObjectOutputStream out) throws IOException {
    // Don't call out.defaultWriteObject()

    // Copy perms into a Hashtable
    Hashtable<String, Permission> permissions =
        new Hashtable<>(perms.size()*2);
    permissions.putAll(perms);

    // Write out serializable fields
    ObjectOutputStream.PutField pfields = out.putFields();
    pfields.put("all_allowed", all_allowed);
    pfields.put("permissions", permissions);
    out.writeFields();
}
 
Example 15
Project: javaide   File: CreateHashtableFromHashMap.java   View Source Code Vote up 5 votes
public static void main(String[] args) {

    //create HashMap
    HashMap hMap = new HashMap();

    //populate HashMap
    hMap.put("1", "One");
    hMap.put("2", "Two");
    hMap.put("3", "Three");

    //create new Hashtable
    Hashtable ht = new Hashtable();

    //populate Hashtable
    ht.put("1", "This value would be REPLACED !!");
    ht.put("4", "Four");

    //print values of Hashtable before copy from HashMap
    System.out.println("Hashtable contents before copy");
    Enumeration e = ht.elements();
    while (e.hasMoreElements()) System.out.println(e.nextElement());

    /*
      To copy values from HashMap to Hashtable use
      void putAll(Map m) method of Hashtable class.

      Please note that this method will REPLACE existing mapping of
      a key if any in the Hashtable
    */

    ht.putAll(hMap);

    //display contents of Hashtable
    System.out.println("Hashtable contents after copy");
    e = ht.elements();
    while (e.hasMoreElements()) System.out.println(e.nextElement());
  }
 
Example 16
Project: TrabalhoFinalEDA2   File: mxGraphComponent.java   View Source Code Vote up 5 votes
/**
 * Returns a hashtable with all entries from the overlays variable where a
 * cell still exists in the model. The entries are removed from the global
 * hashtable so that the remaining entries reflect those whose cell have
 * been removed from the model. If no state is available for a given cell
 * then its overlays are temporarly removed from the rendering control, but
 * kept in the result.
 */
public Hashtable<Object, mxICellOverlay[]> updateCellOverlays(Object cell)
{
	Hashtable<Object, mxICellOverlay[]> result = new Hashtable<Object, mxICellOverlay[]>();
	mxICellOverlay[] c = overlays.remove(cell);
	mxCellState state = getGraph().getView().getState(cell);

	if (c != null)
	{
		if (state != null)
		{
			for (int i = 0; i < c.length; i++)
			{
				updateCellOverlayComponent(state, c[i]);
			}
		}
		else
		{
			for (int i = 0; i < c.length; i++)
			{
				removeCellOverlayComponent(c[i], cell);
			}
		}

		result.put(cell, c);
	}

	int childCount = getGraph().getModel().getChildCount(cell);

	for (int i = 0; i < childCount; i++)
	{
		result.putAll(updateCellOverlays(getGraph().getModel().getChildAt(
				cell, i)));
	}

	return result;
}
 
Example 17
Project: Tarski   File: mxGraphComponent.java   View Source Code Vote up 5 votes
/**
 * 
 */
public Hashtable<Object, Component[]> updateComponents(Object cell) {
  Hashtable<Object, Component[]> result = new Hashtable<Object, Component[]>();
  Component[] c = components.remove(cell);
  mxCellState state = getGraph().getView().getState(cell);

  if (state != null) {
    if (c == null) {
      c = createComponents(state);

      if (c != null) {
        for (int i = 0; i < c.length; i++) {
          insertComponent(state, c[i]);
        }
      }
    }

    if (c != null) {
      result.put(cell, c);

      for (int i = 0; i < c.length; i++) {
        updateComponent(state, c[i]);
      }
    }
  }
  // Puts the component back into the map so that it will be removed
  else if (c != null) {
    components.put(cell, c);
  }

  int childCount = getGraph().getModel().getChildCount(cell);

  for (int i = 0; i < childCount; i++) {
    result.putAll(updateComponents(getGraph().getModel().getChildAt(cell, i)));
  }

  return result;
}
 
Example 18
Project: Tarski   File: mxGraphComponent.java   View Source Code Vote up 5 votes
/**
 * Returns a hashtable with all entries from the overlays variable where a cell still exists in
 * the model. The entries are removed from the global hashtable so that the remaining entries
 * reflect those whose cell have been removed from the model. If no state is available for a given
 * cell then its overlays are temporarly removed from the rendering control, but kept in the
 * result.
 */
public Hashtable<Object, mxICellOverlay[]> updateCellOverlays(Object cell) {
  Hashtable<Object, mxICellOverlay[]> result = new Hashtable<Object, mxICellOverlay[]>();
  mxICellOverlay[] c = overlays.remove(cell);
  mxCellState state = getGraph().getView().getState(cell);

  if (c != null) {
    if (state != null) {
      for (int i = 0; i < c.length; i++) {
        updateCellOverlayComponent(state, c[i]);
      }
    } else {
      for (int i = 0; i < c.length; i++) {
        removeCellOverlayComponent(c[i], cell);
      }
    }

    result.put(cell, c);
  }

  int childCount = getGraph().getModel().getChildCount(cell);

  for (int i = 0; i < childCount; i++) {
    result.putAll(updateCellOverlays(getGraph().getModel().getChildAt(cell, i)));
  }

  return result;
}
 
Example 19
Project: alfresco-repository   File: LDAPInitialDirContextFactoryImpl.java   View Source Code Vote up 4 votes
public InitialDirContext getDefaultIntialDirContext(int pageSize, AuthenticationDiagnostic diagnostic) throws AuthenticationException
{
    Hashtable<String, String> env = new Hashtable<String, String>(defaultEnvironment.size());
    env.putAll(defaultEnvironment);
    return buildInitialDirContext(env, pageSize, diagnostic);
}
 
Example 20
Project: TrabalhoFinalEDA2   File: mxGraphComponent.java   View Source Code Vote up 4 votes
/**
 * 
 */
public Hashtable<Object, Component[]> updateComponents(Object cell)
{
	Hashtable<Object, Component[]> result = new Hashtable<Object, Component[]>();
	Component[] c = components.remove(cell);
	mxCellState state = getGraph().getView().getState(cell);

	if (state != null)
	{
		if (c == null)
		{
			c = createComponents(state);

			if (c != null)
			{
				for (int i = 0; i < c.length; i++)
				{
					insertComponent(state, c[i]);
				}
			}
		}

		if (c != null)
		{
			result.put(cell, c);

			for (int i = 0; i < c.length; i++)
			{
				updateComponent(state, c[i]);
			}
		}
	}
	// Puts the component back into the map so that it will be removed
	else if (c != null)
	{
		components.put(cell, c);
	}

	int childCount = getGraph().getModel().getChildCount(cell);

	for (int i = 0; i < childCount; i++)
	{
		result.putAll(updateComponents(getGraph().getModel().getChildAt(
				cell, i)));
	}

	return result;
}