File tree Expand file tree Collapse file tree 2 files changed +50
-0
lines changed
Sources/JavaKitCollection Expand file tree Collapse file tree 2 files changed +50
-0
lines changed Original file line number Diff line number Diff line change
1
+ //===----------------------------------------------------------------------===//
2
+ //
3
+ // This source file is part of the Swift.org open source project
4
+ //
5
+ // Copyright (c) 2024 Apple Inc. and the Swift.org project authors
6
+ // Licensed under Apache License v2.0
7
+ //
8
+ // See LICENSE.txt for license information
9
+ // See CONTRIBUTORS.txt for the list of Swift.org project authors
10
+ //
11
+ // SPDX-License-Identifier: Apache-2.0
12
+ //
13
+ //===----------------------------------------------------------------------===//
14
+ import JavaKit
15
+
16
+ extension JavaIterator : IteratorProtocol {
17
+ public typealias Element = E
18
+
19
+ public func next( ) -> E ? {
20
+ if hasNext ( ) {
21
+ let nextResult : JavaObject ? = next ( )
22
+ return nextResult. map { $0. as ( E . self) ! }
23
+ }
24
+
25
+ return nil
26
+ }
27
+ }
Original file line number Diff line number Diff line change
1
+ //===----------------------------------------------------------------------===//
2
+ //
3
+ // This source file is part of the Swift.org open source project
4
+ //
5
+ // Copyright (c) 2024 Apple Inc. and the Swift.org project authors
6
+ // Licensed under Apache License v2.0
7
+ //
8
+ // See LICENSE.txt for license information
9
+ // See CONTRIBUTORS.txt for the list of Swift.org project authors
10
+ //
11
+ // SPDX-License-Identifier: Apache-2.0
12
+ //
13
+ //===----------------------------------------------------------------------===//
14
+
15
+ extension List : Sequence {
16
+ public typealias Element = E
17
+ public typealias Iterator = JavaIterator < E >
18
+
19
+ public func makeIterator( ) -> Iterator {
20
+ return self . iterator ( ) !. as ( JavaIterator< E> . self ) !
21
+ }
22
+ }
23
+
You can’t perform that action at this time.
0 commit comments