%REM Copyright 2022-23 HCL America, Inc. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. %END REM Option Declare Option Public Use "../../src/VoltScriptCollections" ' change this to point to the location of your VoltScriptCollections.vss file Sub Initialize Dim map as New Map("STRING", Nothing, False) Dim i as Long Print "===Unsorted Map===" Call map.put("AZ", "Arizona") Call map.put("FL", "Florida") Call map.put("IO", "Iowa") Call map.put("NE", "Nebraska") Call map.put("PA", "Pennsylvania") Call map.put("AL", "Alabama") Do Print map.getNthValueRaw(i) Loop While ++i < map.elementCount Print "===Addition===" i = 0 Call map.put("CA", "California") Do Print map.getNthValueRaw(i) Loop While ++i < map.elementCount Print "===Sorted Map===" i = 0 Dim map2 as new Map("STRING", Nothing, True) Call map2.putAll(map) Do Print map2.getNthValueRaw(i) Loop While ++i < map2.elementCount Print "===Addition===" i = 0 Call map2.put("NY", "New York") Do Print map2.getNthValueRaw(i) Loop While ++i < map2.elementCount Print "===Reversing===" i = 0 Call map2.reverse() Call map2.put("WA", "Washington") Do Print map2.getNthValueRaw(i) Loop While ++i < map2.elementCount Print "===Checking for Elements===" If (IsEmpty(map2.getValueRawByKey("CO"))) Then Print "Could not find CO" Else Print "Found CO" End If If (map2.containsKey("NY")) Then Print "Found NY" Else Print "Could not find NY" End If If (map2.contains("Las Vegas", Nothing)) Then Print "Found Las Vegas" Else Print "Could not find Las Vegas" End If End Sub