In Java maps when we need to insert some values then we use:
map.put(key, value);
In other languages such as with C++ maps or Python dictionaries we can use square brackets:
map['key'] = value
This syntax is not valid with Java maps. Can we change this syntax programmatically by writing some code or using some library?
In Java, you cannot. There are very few languages that allow customization of syntax. Perl, for example, has "pragmas" that are basically other Perl code that preprocesses your script before it runs. It's very powerful but also horrible.
If you need compatibility with Java but like nice syntax, I would suggest Kotlin instead, which (like C++ and Python) allows operator overloading.