Question: I was implementing a Java application when I came across this scenario and couldn't find which way is better to do it and why. following is the scenario.

I have a static list that will load data on application startup.

In my ApplicationStartup class I have 

```
public static List<Map<String,Object>> stockSymbolsListMap;

```

Now when I load this List using a function in my Utility class I have the following code:

```
//Check if the list has been initialized or not
if(ApplicationStartup.stockSymbolsListMap == null){

    ApplicationStartup.stockSymbolsListMap = new ArrayList<Map<String,Object>>();

    } else if(!(ApplicationStartup.stockSymbolsListMap.isEmpty())){

        // Clear the list to avoid redundancy
        ApplicationStartup.stockSymbolsListMap.clear();

    }

    // Adding all stock symbols to the list
    while(allStockSymbols.hasNext()){
        ApplicationStartup.stockSymbolsListMap.add(allStockSymbols.next().toMap());
    }

```

Isn't it better that I initialize this list in my ApplicationStartup class itself?

```
public static List<Map<String,Object>> stockSymbolsListMap = new ArrayList<Map<String,Object>>();

```

Answer: 
Although this question has been answered, please allow me to add a few things:
When examining the source of `and`, you get:

```
and :: [Bool] -> Bool
and = foldr (&&) True

```

First thing to notice is that `and` takes a list of Boolean variables, and returns a single Boolean variable, and that the expression `x mod y /= 0` evaluates to True or False (Hence fitting the [Bool] requirement) . 

More important to notice is that `foldr` is a lazy-fold. So a lazy fold here is optimal because `&&` is a semi-strict operator. Hence a lazy fold in combination with a semi-strict operator will yield a short-circuit evaluation upon encountering the first occurence of a `False`. Hence in the cases of actual *non-prime numbers*, `and` will avoid evaluating the entire list, consequently saving you time as a result. Don't take my word for it, define your own strict version of `and` if you want (using the stricter `foldl`):

```
andStrict :: [Bool] -> Bool
andStrict x = foldl (&&) True

primeStrict :: (Integral a) => a -> Bool
primeStrict x = andStrict [x `mod` y /= 0 | y <- [2..(x-1)]]

```

Now run:

```
prime 2000000000

```

Notice how that was fast? Now do this, but interrupt it before it crashes your memory-stack:

```
primeStrict 2000000000

```

That was obviously slower, you were able to interrupt it. This is the role of `and`, and that is why `and` was written with `foldr`, and hence why it was chosen for the example code you posted. Hope that helps as a supportive answer.
The expression

```
[x `mod` y /= 0 | y <- [2..(x - 1)]

```

is a list of `Bool`s because `mod x y /= 0` (prefix notation because of backtick formatting) returns a `Bool`. The `and` function just does a logical AND of every element in a list, so

```
and [True, False] == False
and [True, True] == True

```