// HashSet - not 100% equivalent
// check: https://learn.microsoft.com/en-us/dotnet/api/system.collections.generic.hashset-1?view=net-8.0
using System;
using System.Collections.Generic;
public class Program
{
public static void Main(string[] args)
{
String[] crew = {"c#", "c", "c++", "java", "python", "php"};
HashSet<String> hashSet = new HashSet<String>(crew);
foreach (String value in hashSet){
Console.Write(value + " ");
}
hashSet.Remove("c++");
Console.WriteLine();
foreach (String value in hashSet){
Console.Write(value + " ");
}
hashSet.Add("c++");
hashSet.Add("go");
Console.WriteLine();
foreach (String value in hashSet){
Console.Write(value + " ");
}
hashSet.Remove("c++");
hashSet.TrimExcess();
hashSet.Add("c++");
Console.WriteLine();
foreach (String value in hashSet){
Console.Write(value + " ");
}
}
}
/*
run:
c# c c++ java python php
c# c java python php
c# c c++ java python php go
c# c java python php go c++
*/