SortedSet functionLimits = new TreeSet(displayOrderComparator); Set permissions = this.getPermissions(); Iterator permissionsIterator = permissions.iterator();  while (permissionsIterator.hasNext()) { Permission permission = (Permission)(permissionsIterator.next()); Set permissionLimits = ((PermissionImpl)permission).getLimits();  Iterator permissionLimitsIterator = permissionLimits.iterator(); while (permissionLimitsIterator.hasNext()) { LimitImpl limitImpl = (LimitImpl)(permissionLimitsIterator.next()); if (this.getSignet() != null) { limitImpl.setSignet(this.getSignet()); } }  functionLimits.addAll(permissionLimits); }  Limit[] limitsArray = new Limit[0]; return (Limit[])(functionLimits.toArray(limitsArray));
Arrays.sort(limitArray, displayOrderComparator); return limitArray;
  public Limit[] getLimitsArray()  {    Comparator displayOrderComparator    	= new Comparator()    	    {            public int compare(Object o1, Object o2)            {              return              	((Limit)o1).getDisplayOrder() - ((Limit)o2).getDisplayOrder();            }    	    };    	        SortedSet functionLimits = new TreeSet(displayOrderComparator);    Set permissions = this.getPermissions();    Iterator permissionsIterator = permissions.iterator();        while (permissionsIterator.hasNext())    {      Permission permission = (Permission)(permissionsIterator.next());      Set permissionLimits = ((PermissionImpl)permission).getLimits();            Iterator permissionLimitsIterator = permissionLimits.iterator();      while (permissionLimitsIterator.hasNext())      {        LimitImpl limitImpl = (LimitImpl)(permissionLimitsIterator.next());        if (this.getSignet() != null)        {          limitImpl.setSignet(this.getSignet());        }      }            functionLimits.addAll(permissionLimits);    }    Limit[] limitsArray = new Limit[0];    return (Limit[])(functionLimits.toArray(limitsArray));  }