Skip to content

Commit f7680c3

Browse files
authored
Merge pull request #210 from jecisc/speed-up-asDataSeries
Speed up DataSeries class>>#newFrom:
2 parents 3451016 + 5125fb0 commit f7680c3

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

src/DataFrame/DataSeries.class.st

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,15 +10,15 @@ Class {
1010

1111
{ #category : #'instance creation' }
1212
DataSeries class >> newFrom: aCollection [
13+
1314
aCollection ifEmpty: [ ^ self new ].
1415

15-
(aCollection species == self)
16-
ifTrue: [ ^ super newFrom: aCollection associations ].
16+
aCollection species == self ifTrue: [ ^ super newFrom: aCollection associations ].
1717

1818
"If it's a collection of associations use the superclass implementation"
19-
^ super newFrom: ((aCollection anyOne respondsTo: #key)
20-
ifTrue: [ aCollection ]
21-
ifFalse: [ aCollection withIndexCollect: [ :each :i | i -> each ] ])
19+
^ super newFrom: (aCollection anyOne isAssociation
20+
ifTrue: [ aCollection ]
21+
ifFalse: [ aCollection withIndexCollect: [ :each :i | i -> each ] ])
2222
]
2323

2424
{ #category : #'instance creation' }

0 commit comments

Comments
 (0)