Skip to content

Commit 2eb6f2c

Browse files
stokitoguusdk
authored andcommitted
refactor: use for each instead of iterator
1 parent 4c4dc50 commit 2eb6f2c

1 file changed

Lines changed: 2 additions & 7 deletions

File tree

src/java/org/jivesoftware/openfire/plugin/SearchPlugin.java

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -665,9 +665,7 @@ private Hashtable<String, String> extractSearchQuery(Element incomingForm) {
665665
// since not all clients request which fields are available for
666666
// searching attempt to match submitted fields with available search
667667
// fields
668-
Iterator<Element> iter = incomingForm.elementIterator();
669-
while (iter.hasNext()) {
670-
Element element = iter.next();
668+
for (Element element : incomingForm.elements()) {
671669
String name = element.getName();
672670

673671
if (fieldLookup.containsKey(name)) {
@@ -698,10 +696,7 @@ private Hashtable<String, String> extractExtendedSearchQuery(Element incomingFor
698696
List<String> searchFields = new ArrayList<String>();
699697
String search = "";
700698

701-
Iterator<Element> fields = dataform.elementIterator("field");
702-
while (fields.hasNext()) {
703-
Element searchField = fields.next();
704-
699+
for (Element searchField : dataform.elements("field")) {
705700
String field = searchField.attributeValue("var");
706701
String value = "";
707702
if (searchField.element("value") != null) {

0 commit comments

Comments
 (0)