Skip to content

Commit 126891b

Browse files
committed
Unify coding styles
1 parent 672e8f6 commit 126891b

File tree

1 file changed

+22
-22
lines changed

1 file changed

+22
-22
lines changed

stream.go

Lines changed: 22 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -298,7 +298,7 @@ func SetFromArrayInterface(list []interface{}) *MapSetDef[interface{}, interface
298298
}
299299

300300
// MapKey Map all keys of Set by function
301-
func (mapSetSelf *MapSetDef[T, R]) MapKey(fn TransformerFunctor[T, T]) *MapSetDef[T, R] {
301+
func (mapSetSelf *MapSetDef[T, R]) MapKey(fn TransformerFunctor[T, T]) SetDef[T, R] {
302302
result := make(MapSetDef[T, R], len(*mapSetSelf))
303303
for k, v := range *mapSetSelf {
304304
result[fn(k)] = v
@@ -308,7 +308,7 @@ func (mapSetSelf *MapSetDef[T, R]) MapKey(fn TransformerFunctor[T, T]) *MapSetDe
308308
}
309309

310310
// MapValue Map all values of Set by function
311-
func (mapSetSelf *MapSetDef[T, R]) MapValue(fn TransformerFunctor[R, R]) *MapSetDef[T, R] {
311+
func (mapSetSelf *MapSetDef[T, R]) MapValue(fn TransformerFunctor[R, R]) SetDef[T, R] {
312312
result := make(MapSetDef[T, R], len(*mapSetSelf))
313313
for k, v := range *mapSetSelf {
314314
result[k] = fn(v)
@@ -334,25 +334,25 @@ func (mapSetSelf *MapSetDef[T, R]) ContainsValue(input R) bool {
334334
}
335335

336336
// IsSubsetByKey returns true or false by checking if set1 is a subset of set2
337-
func (mapSetSelf *MapSetDef[T, R]) IsSubsetByKey(input *MapSetDef[T, R]) bool {
338-
return IsSubsetMapByKey(*mapSetSelf, *input)
337+
func (mapSetSelf *MapSetDef[T, R]) IsSubsetByKey(input SetDef[T, R]) bool {
338+
return IsSubsetMapByKey(*mapSetSelf, input.AsMap())
339339
}
340340

341341
// IsSupersetByKey returns true or false by checking if set1 is a superset of set2
342-
func (mapSetSelf *MapSetDef[T, R]) IsSupersetByKey(input *MapSetDef[T, R]) bool {
343-
return IsSupersetMapByKey(*mapSetSelf, *input)
342+
func (mapSetSelf *MapSetDef[T, R]) IsSupersetByKey(input SetDef[T, R]) bool {
343+
return IsSupersetMapByKey(*mapSetSelf, input.AsMap())
344344
}
345345

346346
// Add Add items into the Set
347-
func (mapSetSelf *MapSetDef[T, R]) Add(input ...T) *MapSetDef[T, R] {
347+
func (mapSetSelf *MapSetDef[T, R]) Add(input ...T) SetDef[T, R] {
348348
inputLen := len(input)
349349
if inputLen > 0 {
350350
result := mapSetSelf.Clone()
351351
for _, v := range input {
352-
if _, ok := (*result)[v]; ok {
352+
if _, ok := result.AsMap()[v]; ok {
353353
continue
354354
}
355-
(*result)[v] = *new(R)
355+
result.AsMap()[v] = *new(R)
356356
}
357357

358358
return result
@@ -362,12 +362,12 @@ func (mapSetSelf *MapSetDef[T, R]) Add(input ...T) *MapSetDef[T, R] {
362362
}
363363

364364
// RemoveKeys Remove keys from the Set
365-
func (mapSetSelf *MapSetDef[T, R]) RemoveKeys(input ...T) *MapSetDef[T, R] {
365+
func (mapSetSelf *MapSetDef[T, R]) RemoveKeys(input ...T) SetDef[T, R] {
366366
inputLen := len(input)
367367
if inputLen > 0 {
368368
result := mapSetSelf.Clone()
369369
for _, v := range input {
370-
delete(*result, v)
370+
delete(result.AsMap(), v)
371371
}
372372

373373
return result
@@ -377,14 +377,14 @@ func (mapSetSelf *MapSetDef[T, R]) RemoveKeys(input ...T) *MapSetDef[T, R] {
377377
}
378378

379379
// RemoveValues Remove values from the Set
380-
func (mapSetSelf *MapSetDef[T, R]) RemoveValues(input ...R) *MapSetDef[T, R] {
380+
func (mapSetSelf *MapSetDef[T, R]) RemoveValues(input ...R) SetDef[T, R] {
381381
inputLen := len(input)
382382
if inputLen > 0 {
383383
result := mapSetSelf.Clone()
384384
valueMap := SliceToMap(0, input...)
385385
for k, v := range *mapSetSelf {
386386
if _, ok := valueMap[v]; ok {
387-
delete(*result, k)
387+
delete(result.AsMap(), k)
388388
}
389389
}
390390

@@ -407,45 +407,45 @@ func (mapSetSelf *MapSetDef[T, R]) Set(key T, value R) {
407407
}
408408

409409
// Clone Clone this Set
410-
func (mapSetSelf *MapSetDef[T, R]) Clone() *MapSetDef[T, R] {
410+
func (mapSetSelf *MapSetDef[T, R]) Clone() SetDef[T, R] {
411411
result := MapSetDef[T, R](DuplicateMap[T, R](*mapSetSelf))
412412

413413
return &result
414414
}
415415

416416
// Union Union an another Set object
417-
func (mapSetSelf *MapSetDef[T, R]) Union(input *MapSetDef[T, R]) *MapSetDef[T, R] {
417+
func (mapSetSelf *MapSetDef[T, R]) Union(input SetDef[T, R]) SetDef[T, R] {
418418
if input == nil || input.Size() == 0 {
419419
return mapSetSelf
420420
}
421421

422-
result := MapSetDef[T, R](Merge(*mapSetSelf, *input))
422+
result := MapSetDef[T, R](Merge(*mapSetSelf, input.AsMap()))
423423

424424
return &result
425425
}
426426

427427
// Intersection Get the Intersection with this Set and an another Set
428-
func (mapSetSelf *MapSetDef[T, R]) Intersection(input *MapSetDef[T, R]) *MapSetDef[T, R] {
428+
func (mapSetSelf *MapSetDef[T, R]) Intersection(input SetDef[T, R]) SetDef[T, R] {
429429
if input == nil || input.Size() == 0 {
430430
return new(MapSetDef[T, R])
431431
}
432432

433-
result := MapSetDef[T, R](IntersectionMapByKey(*mapSetSelf, *input))
433+
result := MapSetDef[T, R](IntersectionMapByKey(*mapSetSelf, input.AsMap()))
434434

435435
return &result
436436
}
437437

438438
// Minus Get all of this Set but not in the given Set
439-
func (mapSetSelf *MapSetDef[T, R]) Minus(input *MapSetDef[T, R]) *MapSetDef[T, R] {
439+
func (mapSetSelf *MapSetDef[T, R]) Minus(input SetDef[T, R]) SetDef[T, R] {
440440
if input == nil || input.Size() == 0 {
441441
return mapSetSelf
442442
}
443443

444444
result := mapSetSelf.Clone()
445-
for k := range *result {
446-
_, exists := (*input)[k]
445+
for k := range result.AsMap() {
446+
_, exists := input.AsMap()[k]
447447
if exists {
448-
delete(*result, k)
448+
delete(result.AsMap(), k)
449449
}
450450
}
451451

0 commit comments

Comments
 (0)