Use HashMap.getOrDefault()

This commit is contained in:
Duy Tran Khanh 2022-03-02 20:00:36 +07:00 committed by GitHub
parent 1f1d542ed7
commit b0af8e43f4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -892,11 +892,7 @@ public class GLFW
} }
public static int glfwGetWindowAttrib(@NativeType("GLFWwindow *") long window, int attrib) { public static int glfwGetWindowAttrib(@NativeType("GLFWwindow *") long window, int attrib) {
Object obj = internalGetWindow(window).windowAttribs.get(attrib); return internalGetWindow(window).windowAttribs.getOrDefault(attrib, 0);
if (obj == null) {
return 0;
}
return (int) obj;
} }
public static void glfwSetWindowAttrib(@NativeType("GLFWwindow *") long window, int attrib, int value) { public static void glfwSetWindowAttrib(@NativeType("GLFWwindow *") long window, int attrib, int value) {