Hello Codeforces Community, ↵
I am new to java until now I have done all of my competitive programming in C++ 17 and now I want to learn basic JAVA through sports programming .↵
I have searched for it on google but i'm confused with various type of map containers available in java , Please guide me .↵
↵
~~~~~↵
#include<iostream>↵
#include<map>↵
using namespace std;↵
int main(){↵
map<int ,int > M;↵
int n;↵
cin>>n;↵
int a[n];↵
for(int i=0;i<n;i++){↵
cin>>a[i]; ↵
M[a[i]]++;↵
}↵
if(M.find(10)!=M.end()){↵
cout<<"10 is present \n ";↵
}↵
for(auto x: M){↵
cout<<x.first<<" "<<x.second<<"\n";↵
}↵
return 0;↵
}↵
~~~~~↵
↵
Please Tell me the alternative Java Code↵
Thanks in Advanced
I am new to java until now I have done all of my competitive programming in C++ 17 and now I want to learn basic JAVA through sports programming .↵
I have searched for it on google but i'm confused with various type of map containers available in java , Please guide me .↵
↵
~~~~~↵
#include<iostream>↵
#include<map>↵
using namespace std;↵
int main(){↵
map<int ,int > M;↵
int n;↵
cin>>n;↵
int a[n];↵
for(int i=0;i<n;i++){↵
cin>>a[i]; ↵
M[a[i]]++;↵
}↵
if(M.find(10)!=M.end()){↵
cout<<"10 is present \n ";↵
}↵
for(auto x: M){↵
cout<<x.first<<" "<<x.second<<"\n";↵
}↵
return 0;↵
}↵
~~~~~↵
↵
Please Tell me the alternative Java Code↵
Thanks in Advanced