ee.List.swap
Zadbaj o dobrą organizację dzięki kolekcji
Zapisuj i kategoryzuj treści zgodnie ze swoimi preferencjami.
Zamienia elementy na określonych pozycjach. Ujemna pozycja jest liczona od końca listy.
Wykorzystanie | Zwroty |
---|
List.swap(pos1, pos2) | Lista |
Argument | Typ | Szczegóły |
---|
to: list | Lista | |
pos1 | Liczba całkowita | |
pos2 | Liczba całkowita | |
O ile nie stwierdzono inaczej, treść tej strony jest objęta licencją Creative Commons – uznanie autorstwa 4.0, a fragmenty kodu są dostępne na licencji Apache 2.0. Szczegółowe informacje na ten temat zawierają zasady dotyczące witryny Google Developers. Java jest zastrzeżonym znakiem towarowym firmy Oracle i jej podmiotów stowarzyszonych.
Ostatnia aktualizacja: 2025-07-26 UTC.
[null,null,["Ostatnia aktualizacja: 2025-07-26 UTC."],[],["The `List.swap` function exchanges elements within a list based on their positions. It accepts two integer arguments, `pos1` and `pos2`, representing the positions of the elements to be swapped. Negative positions are interpreted as offsets from the end of the list. The function modifies the list in place and returns the updated list. It takes the list as input and requires two integer position inputs.\n"],null,[]]