Skip to content

Commit 6026ea5

Browse files
committed
Add "operator" keyword to get and set functions
1 parent b6cfcc0 commit 6026ea5

File tree

10 files changed

+21
-14
lines changed

10 files changed

+21
-14
lines changed

.idea/compiler.xml

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.idea/gradle.xml

Lines changed: 2 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.idea/misc.xml

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ buildscript {
99

1010
}
1111
dependencies {
12-
classpath 'com.android.tools.build:gradle:4.0.1'
12+
classpath 'com.android.tools.build:gradle:4.1.0'
1313
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
1414
classpath 'com.jfrog.bintray.gradle:gradle-bintray-plugin:1.8.4'
1515
classpath 'com.github.dcendents:android-maven-gradle-plugin:2.1'
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
#Wed Apr 10 15:03:59 IDT 2019
1+
#Sun Oct 18 14:45:03 IDT 2020
22
distributionBase=GRADLE_USER_HOME
33
distributionPath=wrapper/dists
44
zipStoreBase=GRADLE_USER_HOME
55
zipStorePath=wrapper/dists
6-
distributionUrl=https\://services.gradle.org/distributions/gradle-6.1.1-all.zip
6+
distributionUrl=https\://services.gradle.org/distributions/gradle-6.5-bin.zip

observablecollections/build.gradle

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ ext {
1616
siteUrl = 'https://github.com/theblitz/ObservableCollections'
1717
gitUrl = 'https://github.com/theblitz/ObservableCollections.git'
1818

19-
libraryVersion = '1.4.1'
19+
libraryVersion = '1.4.2'
2020

2121
developerId = 'theblitz'
2222
developerName = 'Jonathan Blitz'
@@ -33,7 +33,7 @@ android {
3333
minSdkVersion 19
3434
targetSdkVersion 30
3535
versionCode 0
36-
versionName "1.4.0"
36+
versionName "1.4.2"
3737

3838
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
3939

@@ -57,14 +57,14 @@ android {
5757

5858
dependencies {
5959
implementation fileTree(include: ['*.jar'], dir: 'libs')
60-
testImplementation 'junit:junit:4.13'
60+
testImplementation 'junit:junit:4.13.1'
6161
androidTestImplementation 'com.android.support.test:runner:1.0.2'
6262
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
6363
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
6464
// Lifecycle components
6565
implementation 'androidx.lifecycle:lifecycle-extensions:2.2.0'
6666
implementation 'androidx.appcompat:appcompat:1.2.0'
67-
implementation 'androidx.constraintlayout:constraintlayout:2.0.1'
67+
implementation 'androidx.constraintlayout:constraintlayout:2.0.2'
6868
}
6969

7070
tasks.withType(Javadoc).all {

observablecollections/src/main/java/il/co/theblitz/observablecollections/abstracts/ObservableList.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ abstract class ObservableList<X, T: MutableList<X>>(skipCurrentValue: Boolean =
1717
signalChanged(ObservableCollectionsAction.Add, actionInt = index, actionElement = element)
1818
}
1919

20-
fun get(index: Int): X {
20+
operator fun get(index: Int): X {
2121
return collection!![index]
2222
}
2323

@@ -69,7 +69,7 @@ abstract class ObservableList<X, T: MutableList<X>>(skipCurrentValue: Boolean =
6969
signalChanged(ObservableCollectionsAction.Fill, actionElement = value)
7070
}
7171

72-
fun set(index: Int, element: X): X {
72+
operator fun set(index: Int, element: X): X {
7373
val resultElement = collection!!.set(index, element)
7474
signalChanged(ObservableCollectionsAction.Set, actionInt = index, actionElement = element, resultElement = resultElement)
7575
return resultElement

observablecollections/src/main/java/il/co/theblitz/observablecollections/abstracts/ObservableMap.kt

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ import java.util.stream.Stream
7575
return map!!.containsValue(value)
7676
}
7777

78-
fun get(key: X): Y? {
78+
operator fun get(key: X): Y? {
7979
return map!!.get(key)
8080
}
8181

@@ -94,6 +94,10 @@ import java.util.stream.Stream
9494
return resultValue
9595
}
9696

97+
operator fun set(key: X, value: Y): Y? {
98+
return put(key, value)
99+
}
100+
97101
fun putAll(from: Map<out X, Y>) {
98102
map!!.putAll(from)
99103
signalChanged(action = ObservableCollectionsAction.PutAll, actionMap = from)

observablecollections/src/main/java/il/co/theblitz/observablecollections/lists/ObservableLinkedList.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ class ObservableLinkedList<X>(skipCurrentValueCall: Boolean = false): Observable
3333
return collection!!.listIterator(index)
3434
}
3535

36-
fun get(index: Int): X {
36+
operator fun get(index: Int): X {
3737
return collection!!.get(index)
3838
}
3939

@@ -63,7 +63,7 @@ class ObservableLinkedList<X>(skipCurrentValueCall: Boolean = false): Observable
6363
return resultElement
6464
}
6565

66-
fun set(index: Int, element: X): X {
66+
operator fun set(index: Int, element: X): X {
6767
val resultElement = collection!!.set(index, element)
6868
signalChanged(ObservableCollectionsAction.Set, actionInt = index, actionElement = element, resultElement = resultElement)
6969
return resultElement

observablecollections/src/main/java/il/co/theblitz/observablecollections/queues/ObservableArrayBlockingQueue.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ import java.util.concurrent.ArrayBlockingQueue
99
open class ObservableArrayBlockingQueue<X>(skipCurrentValueCall: Boolean = false): ObservableBlockingQueue<X, ArrayBlockingQueue<X>>(skipCurrentValueCall), Serializable {
1010

1111
init {
12-
collection = ArrayBlockingQueue<X>(0)
12+
collection = ArrayBlockingQueue<X>(1)
1313
}
1414

1515
constructor(capacity: Int, fair: Boolean, inCollection: MutableCollection<X>): this() {

0 commit comments

Comments
 (0)