Java 5: 'while' and for-loop replaceable with 'foreach'
This commit is contained in:
committed by
Rossen Stoyanchev
parent
0260d79092
commit
7caa67f302
@@ -338,8 +338,8 @@ public class FlowFacesContext extends FacesContextWrapper {
|
||||
String detail = (String) ois.readObject();
|
||||
int severityOrdinal = ois.readInt();
|
||||
FacesMessage.Severity severity = FacesMessage.SEVERITY_INFO;
|
||||
for (Iterator<?> iterator = FacesMessage.VALUES.iterator(); iterator.hasNext();) {
|
||||
FacesMessage.Severity value = (FacesMessage.Severity) iterator.next();
|
||||
for (Object o : FacesMessage.VALUES) {
|
||||
FacesMessage.Severity value = (FacesMessage.Severity) o;
|
||||
if (value.getOrdinal() == severityOrdinal) {
|
||||
severity = value;
|
||||
}
|
||||
|
||||
@@ -134,8 +134,7 @@ public class ConversationContainer implements Serializable {
|
||||
* Remove identified conversation from this container.
|
||||
*/
|
||||
public synchronized void removeConversation(ConversationId id) {
|
||||
for (Iterator<ContainedConversation> it = conversations.iterator(); it.hasNext();) {
|
||||
ContainedConversation conversation = it.next();
|
||||
for (ContainedConversation conversation : conversations) {
|
||||
if (conversation.getId().equals(id)) {
|
||||
conversations.remove(conversation);
|
||||
break;
|
||||
|
||||
@@ -547,8 +547,8 @@ public abstract class AbstractMvcView implements View {
|
||||
if (!beanWrapper.isReadableProperty(propertyNames.get(0))) {
|
||||
return false;
|
||||
}
|
||||
for (int i=0; i < propertyNames.size(); i++) {
|
||||
if (!SourceVersion.isName(propertyNames.get(i))) {
|
||||
for (String propertyName : propertyNames) {
|
||||
if (!SourceVersion.isName(propertyName)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -261,9 +261,7 @@ public class ImplicitFlowVariableELResolverTests extends FlowDependentELResolver
|
||||
@Test
|
||||
public void testIsReadOnly_AllVars() {
|
||||
RequestContextHolder.setRequestContext(new MockRequestContext());
|
||||
Iterator<String> i = vars.iterator();
|
||||
while (i.hasNext()) {
|
||||
String var = i.next();
|
||||
for (String var : vars) {
|
||||
assertTrue(context.getELResolver().isReadOnly(context, null, var));
|
||||
}
|
||||
}
|
||||
@@ -271,9 +269,7 @@ public class ImplicitFlowVariableELResolverTests extends FlowDependentELResolver
|
||||
@Test
|
||||
public void testSetValue_AllVars() {
|
||||
RequestContextHolder.setRequestContext(new MockRequestContext());
|
||||
Iterator<String> i = vars.iterator();
|
||||
while (i.hasNext()) {
|
||||
String var = i.next();
|
||||
for (String var : vars) {
|
||||
try {
|
||||
context.getELResolver().setValue(context, null, var, new Object());
|
||||
fail("setValue should not be allowed");
|
||||
|
||||
Reference in New Issue
Block a user