@@ -19,7 +19,7 @@ class Router(private val size: Int) {
19
19
fun addPacket (source : Int , destination : Int , timestamp : Int ): Boolean {
20
20
if (map.containsKey(destination)) {
21
21
var found = false
22
- val list: ArrayList <IntArray > = map.get( destination) !!
22
+ val list: ArrayList <IntArray > = map[ destination] !!
23
23
for (i in list.indices.reversed()) {
24
24
if (list[i][1 ] < timestamp) {
25
25
break
@@ -33,7 +33,7 @@ class Router(private val size: Int) {
33
33
}
34
34
}
35
35
if (map.containsKey(destination)) {
36
- val list: ArrayList <IntArray > = map.get( destination) !!
36
+ val list: ArrayList <IntArray > = map[ destination] !!
37
37
list.add(intArrayOf(source, timestamp))
38
38
cur++
39
39
q.offer(intArrayOf(source, destination, timestamp))
@@ -55,7 +55,7 @@ class Router(private val size: Int) {
55
55
return intArrayOf()
56
56
}
57
57
val temp = q.poll()
58
- val list: ArrayList <IntArray > = map.get( temp[1 ]) !!
58
+ val list: ArrayList <IntArray > = map[ temp[1 ]] !!
59
59
list.removeAt(0 )
60
60
if (list.isEmpty()) {
61
61
map.remove(temp[1 ])
@@ -66,7 +66,7 @@ class Router(private val size: Int) {
66
66
67
67
fun getCount (destination : Int , startTime : Int , endTime : Int ): Int {
68
68
if (map.containsKey(destination)) {
69
- val list: ArrayList <IntArray > = map.get( destination) !!
69
+ val list: ArrayList <IntArray > = map[ destination] !!
70
70
var lower = - 1
71
71
var higher = - 1
72
72
for (i in list.indices) {
0 commit comments