File tree Expand file tree Collapse file tree
src/main/java/soot/tagkit Expand file tree Collapse file tree Original file line number Diff line number Diff line change 2323 */
2424
2525import java .util .Collections ;
26+ import java .util .Iterator ;
2627import java .util .List ;
2728import java .util .function .Supplier ;
2829
@@ -59,27 +60,17 @@ public List<Tag> getTags() {
5960 */
6061 @ Override
6162 public void removeTag (String aName ) {
62- int tagIndex = searchForTag (aName );
63- if (tagIndex != -1 ) {
64- mTagList .remove (tagIndex );
65- }
66- }
67-
68- /**
69- * Search for {@link Tag} named {@code aName}.
70- */
71- private int searchForTag (String aName ) {
72- if (mTagList != null ) {
73- for (int i = 0 ; i < mTagList .size (); i ++) {
74- Tag tag = mTagList .get (i );
75- if (tag != null && tag .getName ().equals (aName )) {
76- return i ;
77- }
63+ Iterator <Tag > it = mTagList .iterator ();
64+ while (it .hasNext ()) {
65+ Tag tag = it .next ();
66+ if (tag != null && tag .getName ().equals (aName )) {
67+ it .remove ();
68+ break ;
7869 }
7970 }
80- return -1 ;
8171 }
8272
73+
8374 /**
8475 * Return the {@link Tag} named {@code aName} from {@code this} {@link Host} or {@code null} if there is no such
8576 * {@link Tag}.
@@ -110,7 +101,14 @@ public Tag getTag(String aName) {
110101 */
111102 @ Override
112103 public boolean hasTag (String aName ) {
113- return (searchForTag (aName ) != -1 );
104+ if (mTagList != null ) {
105+ for (Tag tag : mTagList ) {
106+ if (tag != null && tag .getName ().equals (aName )) {
107+ return true ;
108+ }
109+ }
110+ }
111+ return false ;
114112 }
115113
116114 /**
You can’t perform that action at this time.
0 commit comments