pieroxy / java-user-agent-detection

Some code to deduce an OS/Platform/Browser out of a user-agent string
53 stars 12 forks source link

[Performance] Using a default instance (like EMPTY) on to reduce object creation of UserAgentDetectionResult #29

Open trinhnx opened 3 years ago

trinhnx commented 3 years ago

When UserAgentDetector.parseUserAgent() with null or short header, it returns an empty result which has default value. IMHO, this value could be served as a Static instance to reduce the creation. Moreover, the Device, Bot, Locale, OS or Browser also have the empty instance.