Created
November 15, 2012 17:33
-
-
Save aeg/4079974 to your computer and use it in GitHub Desktop.
リストを結合する。
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Case #1 | |
// リストを結合する。 | |
assert [1] + 2 + [3, 4] == [1, 2, 3, 4] | |
def list = [1] | |
// Case #2 | |
// リストを結合する。 | |
list += 2 | |
list += [3, 4] | |
assert list == [1, 2, 3, 4] | |
// Case #3 | |
// リストを結合する。 リストの要素一つ一つを追加する。 | |
list = [1, 2] | |
list.addAll([3, 4]) | |
assert list == [1, 2, 3, 4] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment