コレクションの抽象パラメータ化クラス。
説明
注意事項
要素のデータ型を返します。 |
コレクションが空かどうかを調べます。 |
すべての要素を削除します。 |
コレクションのクローンを返します。 |
要素をフィルタリングします。 |
要素が選別された、コレクションのクローンを返します。 |
コレクションの各要素を含む |
要素のデータ型を返します。
戻り値
例
例 | |
![]() | |
{value || Declare and initialize my-set (a set of strings). let my-set:{Set-of String} = {new {Set-of String}, "apple"} || Display the data type of the elements in my-set. {value my-set.element-type} } |
コレクションが空かどうかを調べます。
戻り値
例
例 | |
![]() | |
{value || Declare and initialize an empty set. let my-set:{Set-of String} = {new {Set-of String}} || Check if the set is empty and display an || appropriate message. {if my-set.empty? then {text The set is empty!} else {text The set has elements!} } } |
例 | |
![]() | |
{value || Declare and initialize a set with elements. let my-set:{Set-of String} = {new {Set-of String}, "apple"} || Check if the set is empty and display an || appropriate message. {if my-set.empty? then {text The set is empty!} else {text The set has elements!} } } |
注意事項
すべての要素を削除します。
説明
例
例 | |
![]() | |
{value || Declare and initialize my-set (a set of strings). let my-set:{Set-of String} = {new {Set-of String}, "apple", "banana", "cherry"} || Clear the set. {my-set.clear} || Check if the set is empty. {text The assertion that the set is empty is... {value my-set.empty?}} } |
注意事項
コレクションのクローンを返します。
戻り値
説明
例
例 | |
![]() | |
{value || Declare and initialize set-1 (the original set). let set-1:{Set-of String} = {new {Set-of String}, "apple", "banana", "cherry"} || Initialize set-2 with a clone of the contents of || set-1. let set-2:{Set-of String} = {set-1.clone} || Use a VBox to display the contents of set-2. || Iterate over the contents of set-2, adding them || to the VBox. Then display the VBox. let message:VBox = {VBox} {for each-element:String in set-2 do {message.add each-element} } message } |
注意事項
注意事項
要素をフィルタリングします。
戻り値
説明
例
例 | |
![]() | |
{value || Declare and initialize my-set (a set of strings). let my-set:{Set-of String} = {new {Set-of String}, "apple", "banana", "cherry"} || Filter elements that begin with the || letter 'a'. {my-set.filter {proc {str:String}:bool {return str[0] != 'a'} } } || Use a VBox to display the contents of my-set. || Iterate over the contents of my-set, adding them || to the VBox. Then display the VBox. let message:VBox = {VBox} {for each-element:String in my-set do {message.add each-element} } message } |
注意事項
要素が選別された、コレクションのクローンを返します。
戻り値
説明
例
例 | |
![]() | |
{value || Declare and initialize set-1 (a set). let set-1:{Set-of String} = {new {Set-of String}, "apple", "banana", "cherry"} || Create a clone set-2 that contains the elements || of set-1 with strings that begin with the letter || 'a' filtered out. let set-2:{Set-of String} = {set-1.filter-clone {proc {str:String}:bool {return str[0] != 'a'} } } || Use a VBox to display the contents of set-2. || Iterate over the contents of set-2, adding them || to the VBox. Then display the VBox. let message:VBox = {VBox} {for each-element:String in set-2 do {message.add each-element} } {value message} } |
注意事項
注意事項
コレクションの各要素を含む
戻り値
説明
例
例 | |
![]() | |
{value || Create a new set. let my-set:{Set-of String} = {new {Set-of String}, "apple", "banana", "cherry"} || Create an Iterator-of from the set. let my-iterator:{Iterator-of String} = {my-set.to-Iterator} || Use a VBox to display the contents of my-iterator. || Iterate over the contents of my-iterator, adding || them to the VBox. Then display the VBox. let message:VBox = {VBox} {for each-element:String in my-iterator do {message.add each-element} } message } |
注意事項
注意事項