From 598fda0c975b5453f34600488c5ed527fcd367c7 Mon Sep 17 00:00:00 2001 From: aaffo Date: Thu, 15 Jul 2021 23:50:44 +0800 Subject: [PATCH] optimized (#819) --- core/collection/set.go | 20 +++++--------------- 1 file changed, 5 insertions(+), 15 deletions(-) diff --git a/core/collection/set.go b/core/collection/set.go index ce845766..1bd6f27f 100644 --- a/core/collection/set.go +++ b/core/collection/set.go @@ -106,9 +106,7 @@ func (s *Set) KeysInt() []int { var keys []int for key := range s.data { - if intKey, ok := key.(int); !ok { - continue - } else { + if intKey, ok := key.(int); ok { keys = append(keys, intKey) } } @@ -121,9 +119,7 @@ func (s *Set) KeysInt64() []int64 { var keys []int64 for key := range s.data { - if intKey, ok := key.(int64); !ok { - continue - } else { + if intKey, ok := key.(int64); ok { keys = append(keys, intKey) } } @@ -136,9 +132,7 @@ func (s *Set) KeysUint() []uint { var keys []uint for key := range s.data { - if intKey, ok := key.(uint); !ok { - continue - } else { + if intKey, ok := key.(uint); ok { keys = append(keys, intKey) } } @@ -151,9 +145,7 @@ func (s *Set) KeysUint64() []uint64 { var keys []uint64 for key := range s.data { - if intKey, ok := key.(uint64); !ok { - continue - } else { + if intKey, ok := key.(uint64); ok { keys = append(keys, intKey) } } @@ -166,9 +158,7 @@ func (s *Set) KeysStr() []string { var keys []string for key := range s.data { - if strKey, ok := key.(string); !ok { - continue - } else { + if strKey, ok := key.(string); ok { keys = append(keys, strKey) } }