Skip to content

Commit acc4a82

Browse files
author
Kim Barrett
committedMar 25, 2024
8328862: Remove unused GrowableArrayFilterIterator
Reviewed-by: dholmes
1 parent 9f920b9 commit acc4a82

File tree

1 file changed

+1
-53
lines changed

1 file changed

+1
-53
lines changed
 

‎src/hotspot/share/utilities/growableArray.hpp

+1-53
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 1997, 2023, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 1997, 2024, Oracle and/or its affiliates. All rights reserved.
33
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
44
*
55
* This code is free software; you can redistribute it and/or modify it
@@ -102,7 +102,6 @@ class GrowableArrayBase : public AnyObj {
102102
};
103103

104104
template <typename E> class GrowableArrayIterator;
105-
template <typename E, typename UnaryPredicate> class GrowableArrayFilterIterator;
106105

107106
// Extends GrowableArrayBase with a typed data array.
108107
//
@@ -841,7 +840,6 @@ class GrowableArrayCHeap : public GrowableArrayWithAllocator<E, GrowableArrayCHe
841840
template <typename E>
842841
class GrowableArrayIterator : public StackObj {
843842
friend class GrowableArrayView<E>;
844-
template <typename F, typename UnaryPredicate> friend class GrowableArrayFilterIterator;
845843

846844
private:
847845
const GrowableArrayView<E>* _array; // GrowableArray we iterate over
@@ -868,56 +866,6 @@ class GrowableArrayIterator : public StackObj {
868866
}
869867
};
870868

871-
// Custom STL-style iterator to iterate over elements of a GrowableArray that satisfy a given predicate
872-
template <typename E, class UnaryPredicate>
873-
class GrowableArrayFilterIterator : public StackObj {
874-
friend class GrowableArrayView<E>;
875-
876-
private:
877-
const GrowableArrayView<E>* _array; // GrowableArray we iterate over
878-
int _position; // Current position in the GrowableArray
879-
UnaryPredicate _predicate; // Unary predicate the elements of the GrowableArray should satisfy
880-
881-
public:
882-
GrowableArrayFilterIterator(const GrowableArrayIterator<E>& begin, UnaryPredicate filter_predicate) :
883-
_array(begin._array), _position(begin._position), _predicate(filter_predicate) {
884-
// Advance to first element satisfying the predicate
885-
while(_position != _array->length() && !_predicate(_array->at(_position))) {
886-
++_position;
887-
}
888-
}
889-
890-
GrowableArrayFilterIterator<E, UnaryPredicate>& operator++() {
891-
do {
892-
// Advance to next element satisfying the predicate
893-
++_position;
894-
} while(_position != _array->length() && !_predicate(_array->at(_position)));
895-
return *this;
896-
}
897-
898-
E operator*() { return _array->at(_position); }
899-
900-
bool operator==(const GrowableArrayIterator<E>& rhs) {
901-
assert(_array == rhs._array, "iterator belongs to different array");
902-
return _position == rhs._position;
903-
}
904-
905-
bool operator!=(const GrowableArrayIterator<E>& rhs) {
906-
assert(_array == rhs._array, "iterator belongs to different array");
907-
return _position != rhs._position;
908-
}
909-
910-
bool operator==(const GrowableArrayFilterIterator<E, UnaryPredicate>& rhs) {
911-
assert(_array == rhs._array, "iterator belongs to different array");
912-
return _position == rhs._position;
913-
}
914-
915-
bool operator!=(const GrowableArrayFilterIterator<E, UnaryPredicate>& rhs) {
916-
assert(_array == rhs._array, "iterator belongs to different array");
917-
return _position != rhs._position;
918-
}
919-
};
920-
921869
// Arrays for basic types
922870
typedef GrowableArray<int> intArray;
923871
typedef GrowableArray<int> intStack;

0 commit comments

Comments
 (0)
Please sign in to comment.