File tree Expand file tree Collapse file tree 1 file changed +11
-25
lines changed
Expand file tree Collapse file tree 1 file changed +11
-25
lines changed Original file line number Diff line number Diff line change @@ -50,8 +50,8 @@ public struct Array<T>
5050 }
5151
5252 //public init(items: inout [T]) { // E59 Duplicate constructor with same signature "init(items var items: T[])"
53- public convenience init ( items: [ T ] ) {
54- var litems = items;
53+ public convenience init ( _ items: [ T ] ) {
54+ var litems = items;
5555 self = Array < T > ( copy: & litems) ;
5656 makeUnique ( ) // workaorund for not having inout
5757 //self.unique = false
@@ -93,13 +93,18 @@ public struct Array<T>
9393 if count == 0 {
9494 list = PlatformList < T > ( )
9595 } else {
96-
9796 #if JAVA
98- list = ArrayList < T > ( count)
97+ list = PlatformList < T > ( count)
98+ for i in 0 ..< count {
99+ list. add ( value)
100+ }
99101 #elseif CLR | ISLAND
100- list = List < T > ( count)
102+ list = PlatformList < T > ( count)
103+ for i in 0 ..< count {
104+ list. Add ( value)
105+ }
101106 #elseif COCOA
102- list = NSMutableArray ( capacity: count)
107+ list = PlatformList ( capacity: count)
103108 for i in 0 ..< count {
104109 list. addObject ( value)
105110 }
@@ -133,25 +138,6 @@ public struct Array<T>
133138 self . init ( sequence: sequence)
134139 }
135140
136- public init ( count: Int , repeatedValue: T ) {
137- #if JAVA
138- list = ArrayList < T > ( count)
139- for i in 0 ..< count {
140- list. add ( repeatedValue)
141- }
142- #elseif CLR | ISLAND
143- list = List < T > ( count)
144- for i in 0 ..< count {
145- list. Add ( repeatedValue)
146- }
147- #elseif COCOA
148- list = NSMutableArray ( capacity: count)
149- for i in 0 ..< count {
150- list. addObject ( repeatedValue)
151- }
152- #endif
153- }
154-
155141 public init ( capacity: Int ) { // not in Apple Swift
156142 #if JAVA
157143 list = ArrayList < T > ( capacity)
You can’t perform that action at this time.
0 commit comments