Check if enum exists in Java

If I need to do this, I sometimes build a Set<String> of the names, or even my own Map<String,MyEnum> – then you can just check that. A couple of points worth noting: Populate any such static collection in a static initializer. Don’t use a variable initializer and then rely on it having been executed when … Read more

How to compare Go errors

Declaring an error, and comparing it with ‘==‘ (as in err == myPkg.ErrTokenExpired) is no longer the best practice with Go 1.13 (Q3 2019) The release notes mentions: Go 1.13 contains support for error wrapping, as first proposed in the Error Values proposal and discussed on the associated issue. An error e can wrap another … Read more

How do I compare two dictionaries in Swift?

As already mentioned by Hot Licks you can use NSDictionary method isEqualToDictionary() to check if they are equal as follow: let dic1: [String: AnyObject] = [“key1”: 100, “key2”: 200] let dic2: [String: AnyObject] = [“key1”: 100, “key2”: 200] let dic3: [String: AnyObject] = [“key1”: 100, “key2”: 250] println( NSDictionary(dictionary: dic1).isEqualToDictionary(dic2) ) // true println( NSDictionary(dictionary: … Read more

Azure DevOps – compare two commits right in the web UI?

If you go to the list of branches for a repository, you can click on … (More Actions) on one of the branches and choose Compare branches This will take you to a URL in the form: https://dev.azure.com/{organisation}/{project}/_git/{repository}/branches?baseVersion=GB{baseBranch}&targetVersion=GB{targetBranch}&_a=files You can then change the baseVersion and targetVersion parameters in the query string. These can take the … Read more

Relationship and difference between HAL and HATEOAS

HATEOAS is a concept of application architecture. It defines the way in which application clients interact with the server, by navigating hypermedia links they find inside resource models returned by the server. To implement HATEOAS you need some standard way of representing resources, that will contain hypermedia information (links to related resources), for example, something … Read more