gwt - What is the meaning of double tilde (~~) in Java?

ID : 20032

viewed : 24

Tags : javagwtbit-manipulationbitwise-operatorsjava

Top 5 Answer for gwt - What is the meaning of double tilde (~~) in Java?

vote vote


In Java, it means nothing.

But that comment says that the line is specifically for GWT, which is a way to compile Java to JavaScript.

In JavaScript, integers are kind of like doubles-that-act-as-integers. They have a max value of 2^53, for instance. But bitwise operators treat numbers as if they're 32-bit, which is exactly what you want in this code. In other words, ~~hash says "treat hash as a 32-bit number" in JavaScript. Specifically, it discards all but the bottom 32 bits (since the bitwise ~ operators only looks at the bottom 32 bits), which is identical to how Java's overflow works.

If you didn't have that, the hash code of the object would be different depending on whether it's evaluated in Java-land or in JavaScript land (via a GWT compilation).

vote vote


export default is used to create local registration for Vue component.

Here is a great article that explain more about components

vote vote


The first case (export default {...}) is ES2015 syntax for making some object definition available for use.

The second case (new Vue (...)) is standard syntax for instantiating an object that has been defined.

The first will be used in JS to bootstrap Vue, while either can be used to build up components and templates.

See for more details.

vote vote


Whenever you use

export someobject 

and someobject is

{  "prop1":"Property1",  "prop2":"Property2", } 

the above you can import anywhere using import or module.js and there you can use someobject. This is not a restriction that someobject will be an object only it can be a function too, a class or an object.

When you say

new Object() 

like you said

new Vue({   el: '#app',   data: [] )} 

Here you are initiating an object of class Vue.

I hope my answer explains your query in general and more explicitly.

vote vote


An Ad-Hoc Query is a query that cannot be determined prior to the moment the query is issued. It is created in order to get information when need arises and it consists of dynamically constructed SQL which is usually constructed by desktop-resident query tools. An ad hoc query does not reside in the computer or the database manager but is dynamically created depending on the needs of the data user.

In SQL, an ad hoc query is a loosely typed command/query whose value depends upon some variable. Each time the command is executed, the result is different, depending on the value of the variable. It cannot be predetermined and usually comes under dynamic programming SQL query. An ad hoc query is short lived and is created at runtime.

Top 3 video Explaining gwt - What is the meaning of double tilde (~~) in Java?