metamodel: PartialOrder::[] fail on wrong key
[nit.git] / src / metamodel / partial_order.nit
index 42a0525..7e7d936 100644 (file)
@@ -58,17 +58,13 @@ special Collection[E]
        # Return the element associed with the item
        meth [](e: E): PartialOrderElement[E]
        do
-               if _elements.has_key(e) then
-                       return _elements[e]
-               else
-                       return null
-               end
+               return _elements[e]
        end
 
        # Return a dot representation
        meth to_dot: String
        do
-               var s = new String
+               var s = new Buffer
                s.append(to_dot_header)
                for e in _elements do
                        s.append(to_dot_node(e.value))
@@ -77,7 +73,7 @@ special Collection[E]
                        end
                end
                s.append("}\n")
-               return s
+               return s.to_s
        end
 
        # Called to display the header