[DS-707] Generify List usage

git-svn-id: http://scm.dspace.org/svn/repo/dspace/trunk@5600 9c30dcfa-912a-0410-8fc2-9e0234be79fd
This commit is contained in:
Graham Triggs
2010-10-24 16:12:57 +00:00
parent 7296ad119d
commit f552805a50
5 changed files with 13 additions and 12 deletions

View File

@@ -57,17 +57,17 @@ public class DCInputSet
private DCInput[][] inputPages = null; private DCInput[][] inputPages = null;
/** constructor */ /** constructor */
public DCInputSet(String formName, List pages, Map listMap) public DCInputSet(String formName, List<List<Map<String, String>>> pages, Map<String, List<String>> listMap)
{ {
this.formName = formName; this.formName = formName;
inputPages = new DCInput[pages.size()][]; inputPages = new DCInput[pages.size()][];
for ( int i = 0; i < inputPages.length; i++ ) for ( int i = 0; i < inputPages.length; i++ )
{ {
List page = (List)pages.get(i); List<Map<String, String>> page = pages.get(i);
inputPages[i] = new DCInput[page.size()]; inputPages[i] = new DCInput[page.size()];
for ( int j = 0; j < inputPages[i].length; j++ ) for ( int j = 0; j < inputPages[i].length; j++ )
{ {
inputPages[i][j] = new DCInput((Map)page.get(j), listMap); inputPages[i][j] = new DCInput(page.get(j), listMap);
} }
} }
} }
@@ -103,7 +103,7 @@ public class DCInputSet
public DCInput[] getPageRows(int pageNum, boolean addTitleAlternative, public DCInput[] getPageRows(int pageNum, boolean addTitleAlternative,
boolean addPublishedBefore) boolean addPublishedBefore)
{ {
List filteredInputs = new ArrayList(); List<DCInput> filteredInputs = new ArrayList<DCInput>();
if ( pageNum < inputPages.length ) if ( pageNum < inputPages.length )
{ {
for (int i = 0; i < inputPages[pageNum].length; i++ ) for (int i = 0; i < inputPages[pageNum].length; i++ )
@@ -118,7 +118,7 @@ public class DCInputSet
// Convert list into an array // Convert list into an array
DCInput[] inputArray = new DCInput[filteredInputs.size()]; DCInput[] inputArray = new DCInput[filteredInputs.size()];
return (DCInput[])filteredInputs.toArray(inputArray); return filteredInputs.toArray(inputArray);
} }
/** /**

View File

@@ -42,6 +42,7 @@ import java.sql.SQLException;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Arrays; import java.util.Arrays;
import java.util.Iterator; import java.util.Iterator;
import java.util.List;
import org.apache.log4j.Logger; import org.apache.log4j.Logger;
import org.dspace.core.Context; import org.dspace.core.Context;
@@ -303,7 +304,7 @@ public class AuthenticationManager
HttpServletRequest request) HttpServletRequest request)
throws SQLException throws SQLException
{ {
ArrayList gll = new ArrayList(); List<int[]> gll = new ArrayList<int[]>();
int totalLen = 0; int totalLen = 0;
for (int i = 0; i < methodStack.length; ++i) for (int i = 0; i < methodStack.length; ++i)
@@ -325,7 +326,7 @@ public class AuthenticationManager
} }
else if (gll.size() == 1) else if (gll.size() == 1)
{ {
return (int[]) gll.get(0); return gll.get(0);
} }
else else
{ {
@@ -335,7 +336,7 @@ public class AuthenticationManager
int k = 0; int k = 0;
for (int i = 0; i < gll.size(); ++i) for (int i = 0; i < gll.size(); ++i)
{ {
int gl[] = (int [])gll.get(i); int gl[] = gll.get(i);
for (int aGl : gl) for (int aGl : gl)
{ {
result[k++] = aGl; result[k++] = aGl;
@@ -352,7 +353,7 @@ public class AuthenticationManager
* *
* @return Iterator object. * @return Iterator object.
*/ */
public static Iterator authenticationMethodIterator() public static Iterator<AuthenticationMethod> authenticationMethodIterator()
{ {
return Arrays.asList(methodStack).iterator(); return Arrays.asList(methodStack).iterator();
} }

View File

@@ -542,7 +542,7 @@ public class AuthorizeManager
"SELECT * FROM resourcepolicy WHERE resource_type_id= ? AND resource_id= ? ", "SELECT * FROM resourcepolicy WHERE resource_type_id= ? AND resource_id= ? ",
o.getType(),o.getID()); o.getType(),o.getID());
List<ResourcePolicy> policies = new ArrayList(); List<ResourcePolicy> policies = new ArrayList<ResourcePolicy>();
try try
{ {

View File

@@ -68,7 +68,7 @@ public class AuthenticationCountSelector implements Selector{
*/ */
public boolean select(String expression, Map objectModel, Parameters parameters) { public boolean select(String expression, Map objectModel, Parameters parameters) {
// get an iterator of all the AuthenticationMethods defined // get an iterator of all the AuthenticationMethods defined
final Iterator<AuthenticationMethod> authMethods = (Iterator<AuthenticationMethod>) AuthenticationManager final Iterator<AuthenticationMethod> authMethods = AuthenticationManager
.authenticationMethodIterator(); .authenticationMethodIterator();
final HttpServletResponse httpResponse = (HttpServletResponse) objectModel final HttpServletResponse httpResponse = (HttpServletResponse) objectModel

View File

@@ -74,7 +74,7 @@ public class LoginRedirect extends AbstractAction {
.get(HttpEnvironment.HTTP_RESPONSE_OBJECT); .get(HttpEnvironment.HTTP_RESPONSE_OBJECT);
final HttpServletRequest httpRequest = (HttpServletRequest) objectModel final HttpServletRequest httpRequest = (HttpServletRequest) objectModel
.get(HttpEnvironment.HTTP_REQUEST_OBJECT); .get(HttpEnvironment.HTTP_REQUEST_OBJECT);
final Iterator<AuthenticationMethod> authMethods = (Iterator<AuthenticationMethod>) AuthenticationManager final Iterator<AuthenticationMethod> authMethods = AuthenticationManager
.authenticationMethodIterator(); .authenticationMethodIterator();
if (authMethods == null) if (authMethods == null)