Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6990125
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T19:18:23+00:00 2026-05-27T19:18:23+00:00

I have a Map whose key and value and custom classes. The key class

  • 0

I have a Map whose key and value and custom classes. The key class is called Position and is instantiated with two int (for example new Position(2, 4).

I got rid of this Position class and converted the map to a SimpleHash in order to use it with Freemarker. I now have a SimpleHash whose key is a String remapping Position values (for example "2 4") and whose value is either null or a Lot (custom) class.

In the template I need to check if the value of a given item in the SimpleMap (passed as map) is either null or a Lot instance.

        <#list mapMinY..mapMaxY as y>
            <tr>
                <#list mapMinX..mapMaxX as x>
                    <td>
                        <div>
                            <!-- Check if map[x + " " + y] is null -->
                            ${x}, ${y}
                        </div>
                    </td>
                </#list>
            </tr>
        </#list>

How to do this?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-27T19:18:24+00:00Added an answer on May 27, 2026 at 7:18 pm

    since freemarker is kind of odd when it comes to null values have two ways to solve it.
    1.Treat it as a missing value :

    ${map[x + " " + y]!}
       do Stuff
    ${map[x + " " + y]!}
    

    2.Just convert that check into a true/false check.
    This could be done by using a utility class whith a isNull(Object obj) function.

    utilClass.isNull(map[x + " " + y])==true
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have two tables. With Sqlalchemy, I map them to two classes: class A(base):
I have unsorted map of key value pairs. input = { xa => xavalue,
I need to define a weak reference Map, whose value is a Set. I
If I have following map: NavigableMap<Integer,String> nmap = new TreeMap<Integer,String>(); nmap.put(3, Three); nmap.put(1, One);
I'm trying to map an @Embeddable object in a subclass whose parent class already
It is often useful to have a field in a DAO whose value comes
Let's say I have a list a in Python whose entries conveniently map to
I'm using a JS array to Map IDs to actual elements, i.e. a key-value
I have a problem where I need to assemble a Map whose eventual size
Give I have a 3D map of type whose the length and width are

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.