// Generated by Haxe 4.3.3
package haxe.root;

import haxe.root.*;

@SuppressWarnings(value={"rawtypes", "unchecked"})
public class Lambda extends haxe.lang.HxObject
{
	public Lambda(haxe.lang.EmptyObject empty)
	{
	}
	
	
	public Lambda()
	{
		//line 39 "/usr/share/haxe/std/Lambda.hx"
		haxe.root.Lambda.__hx_ctor__Lambda(this);
	}
	
	
	protected static void __hx_ctor__Lambda(haxe.root.Lambda __hx_this)
	{
	}
	
	
	public static <A> haxe.root.Array<A> array(java.lang.Object it)
	{
		//line 46 "/usr/share/haxe/std/Lambda.hx"
		haxe.root.Array<A> a = new haxe.root.Array<A>();
		//line 47 "/usr/share/haxe/std/Lambda.hx"
		{
			//line 47 "/usr/share/haxe/std/Lambda.hx"
			java.lang.Object i = ((java.lang.Object) (haxe.lang.Runtime.callField(it, "iterator", null)) );
			//line 47 "/usr/share/haxe/std/Lambda.hx"
			while (haxe.lang.Runtime.toBool(((java.lang.Boolean) (haxe.lang.Runtime.callField(i, "hasNext", null)) )))
			{
				//line 47 "/usr/share/haxe/std/Lambda.hx"
				A i1 = ((A) (haxe.lang.Runtime.callField(i, "next", null)) );
				//line 48 "/usr/share/haxe/std/Lambda.hx"
				a.push(i1);
			}
			
		}
		
		//line 49 "/usr/share/haxe/std/Lambda.hx"
		return a;
	}
	
	
	public static <A> boolean has(java.lang.Object it, A elt)
	{
		//line 109 "/usr/share/haxe/std/Lambda.hx"
		{
			//line 109 "/usr/share/haxe/std/Lambda.hx"
			java.lang.Object x = ((java.lang.Object) (haxe.lang.Runtime.callField(it, "iterator", null)) );
			//line 109 "/usr/share/haxe/std/Lambda.hx"
			while (haxe.lang.Runtime.toBool(((java.lang.Boolean) (haxe.lang.Runtime.callField(x, "hasNext", null)) )))
			{
				//line 109 "/usr/share/haxe/std/Lambda.hx"
				A x1 = ((A) (haxe.lang.Runtime.callField(x, "next", null)) );
				//line 110 "/usr/share/haxe/std/Lambda.hx"
				if (haxe.lang.Runtime.eq(x1, elt)) 
				{
					//line 111 "/usr/share/haxe/std/Lambda.hx"
					return true;
				}
				
			}
			
		}
		
		//line 112 "/usr/share/haxe/std/Lambda.hx"
		return false;
	}
	
	
	public static <A> boolean exists(java.lang.Object it, haxe.lang.Function f)
	{
		//line 126 "/usr/share/haxe/std/Lambda.hx"
		{
			//line 126 "/usr/share/haxe/std/Lambda.hx"
			java.lang.Object x = ((java.lang.Object) (haxe.lang.Runtime.callField(it, "iterator", null)) );
			//line 126 "/usr/share/haxe/std/Lambda.hx"
			while (haxe.lang.Runtime.toBool(((java.lang.Boolean) (haxe.lang.Runtime.callField(x, "hasNext", null)) )))
			{
				//line 126 "/usr/share/haxe/std/Lambda.hx"
				A x1 = ((A) (haxe.lang.Runtime.callField(x, "next", null)) );
				//line 127 "/usr/share/haxe/std/Lambda.hx"
				if (haxe.lang.Runtime.toBool(((java.lang.Boolean) (f.__hx_invoke1_o(0.0, x1)) ))) 
				{
					//line 128 "/usr/share/haxe/std/Lambda.hx"
					return true;
				}
				
			}
			
		}
		
		//line 129 "/usr/share/haxe/std/Lambda.hx"
		return false;
	}
	
	
	public static <A> void iter(java.lang.Object it, haxe.lang.Function f)
	{
		//line 157 "/usr/share/haxe/std/Lambda.hx"
		java.lang.Object x = ((java.lang.Object) (haxe.lang.Runtime.callField(it, "iterator", null)) );
		//line 157 "/usr/share/haxe/std/Lambda.hx"
		while (haxe.lang.Runtime.toBool(((java.lang.Boolean) (haxe.lang.Runtime.callField(x, "hasNext", null)) )))
		{
			//line 157 "/usr/share/haxe/std/Lambda.hx"
			A x1 = ((A) (haxe.lang.Runtime.callField(x, "next", null)) );
			//line 158 "/usr/share/haxe/std/Lambda.hx"
			f.__hx_invoke1_o(0.0, x1);
		}
		
	}
	
	
	public static <A> haxe.root.Array<A> filter(java.lang.Object it, haxe.lang.Function f)
	{
		//line 168 "/usr/share/haxe/std/Lambda.hx"
		haxe.root.Array<A> _g = new haxe.root.Array<A>(( (A[]) (new java.lang.Object[] {}) ));
		//line 168 "/usr/share/haxe/std/Lambda.hx"
		{
			//line 168 "/usr/share/haxe/std/Lambda.hx"
			java.lang.Object x = ((java.lang.Object) (haxe.lang.Runtime.callField(it, "iterator", null)) );
			//line 168 "/usr/share/haxe/std/Lambda.hx"
			while (haxe.lang.Runtime.toBool(((java.lang.Boolean) (haxe.lang.Runtime.callField(x, "hasNext", null)) )))
			{
				//line 168 "/usr/share/haxe/std/Lambda.hx"
				A x1 = ((A) (haxe.lang.Runtime.callField(x, "next", null)) );
				//line 168 "/usr/share/haxe/std/Lambda.hx"
				if (haxe.lang.Runtime.toBool(((java.lang.Boolean) (f.__hx_invoke1_o(0.0, x1)) ))) 
				{
					//line 168 "/usr/share/haxe/std/Lambda.hx"
					_g.push(x1);
				}
				
			}
			
		}
		
		//line 168 "/usr/share/haxe/std/Lambda.hx"
		return _g;
	}
	
	
	public static <A> int count(java.lang.Object it, haxe.lang.Function pred)
	{
		//line 210 "/usr/share/haxe/std/Lambda.hx"
		int n = 0;
		//line 211 "/usr/share/haxe/std/Lambda.hx"
		if (( pred == null )) 
		{
			//line 212 "/usr/share/haxe/std/Lambda.hx"
			java.lang.Object _1 = ((java.lang.Object) (haxe.lang.Runtime.callField(it, "iterator", null)) );
			//line 212 "/usr/share/haxe/std/Lambda.hx"
			while (haxe.lang.Runtime.toBool(((java.lang.Boolean) (haxe.lang.Runtime.callField(_1, "hasNext", null)) )))
			{
				//line 212 "/usr/share/haxe/std/Lambda.hx"
				A _2 = ((A) (haxe.lang.Runtime.callField(_1, "next", null)) );
				//line 213 "/usr/share/haxe/std/Lambda.hx"
				 ++ n;
			}
			
		}
		else
		{
			//line 215 "/usr/share/haxe/std/Lambda.hx"
			java.lang.Object x = ((java.lang.Object) (haxe.lang.Runtime.callField(it, "iterator", null)) );
			//line 215 "/usr/share/haxe/std/Lambda.hx"
			while (haxe.lang.Runtime.toBool(((java.lang.Boolean) (haxe.lang.Runtime.callField(x, "hasNext", null)) )))
			{
				//line 215 "/usr/share/haxe/std/Lambda.hx"
				A x1 = ((A) (haxe.lang.Runtime.callField(x, "next", null)) );
				//line 216 "/usr/share/haxe/std/Lambda.hx"
				if (haxe.lang.Runtime.toBool(((java.lang.Boolean) (((haxe.lang.Function) (pred) ).__hx_invoke1_o(0.0, x1)) ))) 
				{
					//line 217 "/usr/share/haxe/std/Lambda.hx"
					 ++ n;
				}
				
			}
			
		}
		
		//line 218 "/usr/share/haxe/std/Lambda.hx"
		return n;
	}
	
	
	public static <T> T find(java.lang.Object it, haxe.lang.Function f)
	{
		//line 256 "/usr/share/haxe/std/Lambda.hx"
		{
			//line 256 "/usr/share/haxe/std/Lambda.hx"
			java.lang.Object v = ((java.lang.Object) (haxe.lang.Runtime.callField(it, "iterator", null)) );
			//line 256 "/usr/share/haxe/std/Lambda.hx"
			while (haxe.lang.Runtime.toBool(((java.lang.Boolean) (haxe.lang.Runtime.callField(v, "hasNext", null)) )))
			{
				//line 256 "/usr/share/haxe/std/Lambda.hx"
				T v1 = ((T) (haxe.lang.Runtime.callField(v, "next", null)) );
				//line 257 "/usr/share/haxe/std/Lambda.hx"
				if (haxe.lang.Runtime.toBool(((java.lang.Boolean) (f.__hx_invoke1_o(0.0, v1)) ))) 
				{
					//line 258 "/usr/share/haxe/std/Lambda.hx"
					return v1;
				}
				
			}
			
		}
		
		//line 260 "/usr/share/haxe/std/Lambda.hx"
		return null;
	}
	
	
	public static <T> int findIndex(java.lang.Object it, haxe.lang.Function f)
	{
		//line 274 "/usr/share/haxe/std/Lambda.hx"
		int i = 0;
		//line 275 "/usr/share/haxe/std/Lambda.hx"
		{
			//line 275 "/usr/share/haxe/std/Lambda.hx"
			java.lang.Object v = ((java.lang.Object) (haxe.lang.Runtime.callField(it, "iterator", null)) );
			//line 275 "/usr/share/haxe/std/Lambda.hx"
			while (haxe.lang.Runtime.toBool(((java.lang.Boolean) (haxe.lang.Runtime.callField(v, "hasNext", null)) )))
			{
				//line 275 "/usr/share/haxe/std/Lambda.hx"
				T v1 = ((T) (haxe.lang.Runtime.callField(v, "next", null)) );
				//line 276 "/usr/share/haxe/std/Lambda.hx"
				if (haxe.lang.Runtime.toBool(((java.lang.Boolean) (f.__hx_invoke1_o(0.0, v1)) ))) 
				{
					//line 277 "/usr/share/haxe/std/Lambda.hx"
					return i;
				}
				
				//line 278 "/usr/share/haxe/std/Lambda.hx"
				 ++ i;
			}
			
		}
		
		//line 280 "/usr/share/haxe/std/Lambda.hx"
		return -1;
	}
	
	
	public static <T> haxe.root.Array<T> concat(java.lang.Object a, java.lang.Object b)
	{
		//line 290 "/usr/share/haxe/std/Lambda.hx"
		haxe.root.Array<T> l = new haxe.root.Array<T>();
		//line 291 "/usr/share/haxe/std/Lambda.hx"
		{
			//line 291 "/usr/share/haxe/std/Lambda.hx"
			java.lang.Object x = ((java.lang.Object) (haxe.lang.Runtime.callField(a, "iterator", null)) );
			//line 291 "/usr/share/haxe/std/Lambda.hx"
			while (haxe.lang.Runtime.toBool(((java.lang.Boolean) (haxe.lang.Runtime.callField(x, "hasNext", null)) )))
			{
				//line 291 "/usr/share/haxe/std/Lambda.hx"
				T x1 = ((T) (haxe.lang.Runtime.callField(x, "next", null)) );
				//line 292 "/usr/share/haxe/std/Lambda.hx"
				l.push(x1);
			}
			
		}
		
		//line 293 "/usr/share/haxe/std/Lambda.hx"
		{
			//line 293 "/usr/share/haxe/std/Lambda.hx"
			java.lang.Object x2 = ((java.lang.Object) (haxe.lang.Runtime.callField(b, "iterator", null)) );
			//line 293 "/usr/share/haxe/std/Lambda.hx"
			while (haxe.lang.Runtime.toBool(((java.lang.Boolean) (haxe.lang.Runtime.callField(x2, "hasNext", null)) )))
			{
				//line 293 "/usr/share/haxe/std/Lambda.hx"
				T x3 = ((T) (haxe.lang.Runtime.callField(x2, "next", null)) );
				//line 294 "/usr/share/haxe/std/Lambda.hx"
				l.push(x3);
			}
			
		}
		
		//line 295 "/usr/share/haxe/std/Lambda.hx"
		return l;
	}
	
	
}


